29 lines
916 B
C#
29 lines
916 B
C#
|
// <copyright file="PrimaryKeyMissingException.cs" company="alveus.dev">
|
||
|
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
|
||
|
// </copyright>
|
||
|
|
||
|
using Astral.Core.Attributes.EntityAnnotation;
|
||
|
|
||
|
namespace Astral.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; }
|
||
|
}
|