1
0

Refactoring

This commit is contained in:
2021-10-22 21:05:37 +02:00
commit ca9de13c9e
43 changed files with 5145 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System;
using AMWD.Common.EntityFrameworkCore.Extensions;
using Microsoft.EntityFrameworkCore;
namespace AMWD.Common.EntityFrameworkCore.Attributes
{
/// <summary>
/// Property attribute to create indices and unique constraints in the database.
/// </summary>
/// <remarks>
/// Requires <see cref="ModelBuilderExtensions.ApplyIndexAttributes(ModelBuilder)"/> to be called within <see cref="DbContext.OnModelCreating(ModelBuilder)"/>.
/// </remarks>
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public class DatabaseIndexAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseIndexAttribute"/> class.
/// </summary>
public DatabaseIndexAttribute()
{
Name = null;
IsUnique = false;
}
/// <summary>
/// Gets or sets a name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether it is a unique constraint.
/// </summary>
public bool IsUnique { get; set; }
}
}