Files
ProductiveAspNetMvc/Ch07/07_02_Begin/Common/Models/EntityNotFoundException.cs
Jess Chadwick 20458e435e Exercise Files
2018-06-07 00:03:24 -04:00

25 lines
570 B
C#

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)
{
}
}
}