I am just taking a crack at entity framework code first. Following their naming convention, we now have to name our tables plural to not have to intervene with the tool. I know the mappings can be over ridden. My question is, after years of following the singular naming convention are we back to using plural names?
Also, I was wondering why the new examples were using Northwind instead of Adventure Works. I'm thinking the reason is because AW uses singular naming and they wouldn't be able to show off the no code features
The RTM version of Code First will fully support a cool feature called Pluggable Conventions where you can add or replace the default conventions such as the one you mentioned.
Fortunately, what you are looking for is already included in CTP5. You can switch off the pluralizing table names convention with removing PluralizingTableNameConvention convention. This is all the code you need to write for this matter:
using System.Data.Entity.ModelConfiguration.Conventions.Edm.Db; protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); }
About your secound questions, the reason you more see Northwind database than Adventure Works is just because AW is a huge and Northwind is a fairly small database hence make it a better fit for samples and Walkthroughs. That said, you still need to write some code to work with Northwind database in Code First.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With