Specifying singular table names

Entity Framework usually generates Tables with plural names. For example, a Student class would generate a table Students. This could be a little inconvenience for teams who insists on plural names. The solution is to override the 'OnModelCreating' Method to remove the plural features. This would ensure plural names are used in every concerned Context. … Continue reading Specifying singular table names

Advertisements

Composite Primary Key using Data Annotations

When developing domain classes in Entity Framework using Code First Approach, the default code conventions creates a primary key of a property named "ID" or <ClassName>ID. But if you wanted to use another property as your primary key , you can use DataAnnotations and decorate the property using "Key" attribute. What is more interesting is … Continue reading Composite Primary Key using Data Annotations