Exercise Files
This commit is contained in:
25
Ch06/06_03_End/Common/Models/EntityNotFoundException.cs
Normal file
25
Ch06/06_03_End/Common/Models/EntityNotFoundException.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace HPlusSports
|
||||
{
|
||||
public class EntityNotFoundException : ApplicationException
|
||||
{
|
||||
public object Id { get; }
|
||||
public Type Type { get; }
|
||||
|
||||
public EntityNotFoundException(Type type, object id)
|
||||
: base($"Entity ${id?.ToString()} of type ${type?.Name} not found.")
|
||||
{
|
||||
Type = type;
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class EntityNotFoundException<T> : EntityNotFoundException
|
||||
{
|
||||
public EntityNotFoundException(object id) : base(typeof(T), id)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user