galaeth-draft/Galaeth.Core/Exceptions/PrimaryKeyMissingException.cs
2024-11-17 09:31:01 +00:00

25 lines
744 B
C#

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; }
}