galaeth-draft/Galaeth.Core/Attributes/EntityAnnotation/PrimaryKeyAttribute.cs

23 lines
730 B
C#
Raw Normal View History

2024-11-17 10:31:01 +01:00
namespace Galaeth.Core.Attributes.EntityAnnotation;
/// <summary>
/// Treat this property as the primary key in the database.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class PrimaryKeyAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PrimaryKeyAttribute"/> class.
/// </summary>
/// <param name="autoGenerated">If the primary key auto-generated by the database.</param>
public PrimaryKeyAttribute(bool autoGenerated = false)
{
AutoGenerated = autoGenerated;
}
/// <summary>
/// Should this primary key be auto-generated by the database? (i.e. Auto incrementing).
/// </summary>
public bool AutoGenerated { get; }
}