using Microsoft.EntityFrameworkCore; using System; namespace EntityFrameworkBasics { /// /// The database representational model for our application /// public class ApplicationDbContext : DbContext { #region Public Properties /// /// The settings for the application /// public DbSet Settings { get; set; } #endregion #region Constructor /// /// Default constructor, expecting database options passed in /// /// The database context options public ApplicationDbContext(DbContextOptions options) : base(options) { } #endregion protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // Fluent API modelBuilder.Entity().HasIndex(a => a.Name); } } }