| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Runtime.Serialization;
- namespace Abp.Domain.Entities
- {
- /// <summary>
- /// This exception is thrown if an entity excepted to be found but not found.
- /// </summary>
- [Serializable]
- public class EntityNotFoundException : AbpException
- {
- /// <summary>
- /// Type of the entity.
- /// </summary>
- public Type EntityType { get; set; }
- /// <summary>
- /// Id of the Entity.
- /// </summary>
- public object Id { get; set; }
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- public EntityNotFoundException()
- {
- }
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- public EntityNotFoundException(SerializationInfo serializationInfo, StreamingContext context)
- : base(serializationInfo, context)
- {
- }
-
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- public EntityNotFoundException(Type entityType, object id)
- : this(entityType, id, null)
- {
- }
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- 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;
- }
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- /// <param name="message">Exception message</param>
- public EntityNotFoundException(string message)
- : base(message)
- {
- }
- /// <summary>
- /// Creates a new <see cref="EntityNotFoundException"/> object.
- /// </summary>
- /// <param name="message">Exception message</param>
- /// <param name="innerException">Inner exception</param>
- public EntityNotFoundException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
- }
- }
|