Workaround for MySql 5.7 EF DbFirst Issue

Anyone working on .Net application with MySql 5.7 and EF in Db First Approach would have come across what is an officially confirmed bug. ┬áThis bug rises when you attempt to generate/update your Entity Model after changes to the Database. "Unable to generate the model because of the following exception: 'System.Data.StrongTypingException: The value for column … Continue reading Workaround for MySql 5.7 EF DbFirst Issue

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

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