KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I prefer using singular nouns when naming my database tables. In EF code first however, the generated tables always are plural. My DbSets are pluralized which I believe is where EF is generating the names but I don't want to singularize these names as I believe it is more pratical to have them plural in code. I also tried overriding the setting but to no avail. Any ideas? Here is my code and thanks. MyObjectContext.cs public class MyObjectContext : DbContext, IDbContext { public MyObjectContext(string connString) : base(connString) { } public DbSet<Product> Products {get;set;} public DbSet<Category> Categories {get;set;} //etc. protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingEntitySetNameConvention>(); } }
Tags (comma-separated)
Save Edits
Cancel