astral-api/Astral.Core/Exceptions/MissingColumnAttribute.cs
2024-12-11 20:36:30 +00:00

26 lines
896 B
C#

// <copyright file="MissingColumnAttribute.cs" company="alveus.dev">
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
// </copyright>
namespace Astral.Core.Exceptions;
/// <summary>
/// Thrown if an entity has a property that has a primary key attribute, but no column attribute.
/// </summary>
public class MissingColumnAttributeException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="MissingColumnAttributeException" /> class.
/// </summary>
/// <param name="entityType">The entity causing the exception.</param>
public MissingColumnAttributeException(Type entityType)
: base($"Entity '{entityType}' primary key requires a ColumnMapping attribute")
{
EntityType = entityType;
}
/// <summary>
/// The entity type.
/// </summary>
public Type EntityType { get; set; }
}