using System; using System.Runtime.Serialization; namespace Abp.Domain.Entities { /// /// This exception is thrown if an entity excepted to be found but not found. /// [Serializable] public class EntityNotFoundException : AbpException { /// /// Type of the entity. /// public Type EntityType { get; set; } /// /// Id of the Entity. /// public object Id { get; set; } /// /// Creates a new object. /// public EntityNotFoundException() { } /// /// Creates a new object. /// public EntityNotFoundException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) { } /// /// Creates a new object. /// public EntityNotFoundException(Type entityType, object id) : this(entityType, id, null) { } /// /// Creates a new object. /// public EntityNotFoundException(Type entityType, object id, Exception innerException) : base($"There is no such an entity. Entity type: {entityType.FullName}, id: {id}", innerException) { EntityType = entityType; Id = id; } /// /// Creates a new object. /// /// Exception message public EntityNotFoundException(string message) : base(message) { } /// /// Creates a new object. /// /// Exception message /// Inner exception public EntityNotFoundException(string message, Exception innerException) : base(message, innerException) { } } }