27 lines
895 B
C#
27 lines
895 B
C#
|
// <copyright file="PrimaryKeyAttribute.cs" company="alveus.dev">
|
||
|
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
|
||
|
// </copyright>
|
||
|
|
||
|
namespace Astral.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; }
|
||
|
}
|