Search code examples
entity-frameworkedmxdatabase-first

Entity Framework Database First - Relationships


I think I have CodeFirst understood. Now I know database first EF design is targeted for existing databases, but if I were to quickly go in and create a new database in management studio and create some tables, is it normal that you would create relationships for the tables in management studio or in the edmx designer, I tried in the edmx but got errors when I went to debug. What is the best practice here and what are the correct steps to create Associations between tables if I were to do it in the designer and how does the database in management studio know to update? Any tips/advice is appreciated.

enter image description here


Solution

  • In times that the entity is updated, try to Run Custom Tool your model to avoid errors. just Right Click your model and Run Custom Tool.