Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

77 lines
2.2 KiB

using System;
namespace Volo.Abp.Domain.Entities
{
/// <summary>
/// This exception is thrown if an entity excepted to be found but not found.
/// </summary>
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(Type entityType)
: this(entityType, null, null)
{
}
/// <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)
{
}
}
}