Entity conventions
Last updated
Last updated
Code First enables you to describe a model by using C# classes. The basic shape of the model is detected by using conventions. Conventions are sets of rules that are used to automatically configure a conceptual model based on class definitions when working with Code First.
The conventions are defined in the System.Data.Entity.ModelConfiguration.Conventions
namespace. Discussion about the conventions in detail are not in the scope of this module you can refer to the below link for more details:
For this example, let us see how we can get rid of the Id column issue by removing them from the views.
Remove the Id field related markup (shown below for convenience) from all the views that are using it.
Let us run the app again and verify the crud operations end-to-end. We will notice that all the functionalities are working on our demo app!
Completed app is available on GitHub with the following commit ID: