Tips and Hints: Entity Framework bits and pieces
This is a mix of all sorts of tiny bits I find while using Entity Framework. * Singularise tables' names. Tables generated by EF will be named as plural automatically, in order to switch it to use singleton, the plural convention needs removing from model builder. public class MyEntity : DbContext, IDisposable { public DbSet<Product> Product {get;set;} public DbSet<Category> Category {get;set;} public MyEntity(string nameOrConnectionString) : base(nameOrConnectionString) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingEntitySetNameConvention>(); } } * Create a One-To-Many relationship table using Code First, and access it via LINQ. The following setups are used to configure a one-to-many relationship: public class Product { public int ProductID { get; set; } public int CategoryID { get; set; } public Category Category { get; set; } }...