The entity framework course is finished

This commit is contained in:
2020-01-22 23:02:33 +01:00
parent cc8eb0302e
commit 8d11b258bd
6 changed files with 25 additions and 10 deletions

View File

@ -12,8 +12,6 @@ namespace EntityFrameworkBasics
public class ApplicationDBContext : DbContext
{
public string Id { get; set; } = Guid.NewGuid().ToString("N");
#region Public properties
public DbSet<SettingsDataModel> Settings { get; set; }
@ -36,6 +34,9 @@ namespace EntityFrameworkBasics
{
base.OnModelCreating(modelBuilder);
// Fluent Api
modelBuilder.Entity<SettingsDataModel>().HasIndex(c => c.Name).IsUnique();
}
}
}

View File

@ -15,7 +15,6 @@ namespace EntityFrameworkBasics
/// <summary>
/// The settings name
/// </summary>
[Required]
[MaxLength(256)]
public string Name { get; set; }
/// <summary>