galaeth-draft/Galaeth.Core/Exceptions/PrimaryKeyMissingException.cs

25 lines
744 B
C#
Raw Permalink Normal View History

2024-11-17 10:31:01 +01:00
using Galaeth.Core.Attributes.EntityAnnotation;
namespace Galaeth.Core.Exceptions;
/// <summary>
/// Thrown if an entity is missing a property with <see cref="PrimaryKeyAttribute"/>.
/// </summary>
public class PrimaryKeyMissingException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="PrimaryKeyMissingException"/> class.
/// </summary>
/// <param name="entityType">The entity causing the exception.</param>
public PrimaryKeyMissingException(Type entityType)
: base($"Entity '{entityType}' is missing a property with a PrimaryKey.")
{
EntityType = entityType;
}
/// <summary>
/// The entity type.
/// </summary>
public Type EntityType { get; set; }
}