Вопрос

I created an Entity Model and then used code generation to create DBContext classes. When I perform and TSQL update statement in SQL Server on one of my tables, do I have to update my model every time I perform an update when debugging? When I deploy my MVC app, will the model automatically update? Right now I am clicking Run Custom Tool on my Context.tt file. Also, do I get rid of the custom tool property on my former edmx file? Thank you

Это было полезно?

Решение

The entity framework model will not update automatically. If you make changes to columns or tables in the database, you'll need to refresh your model.

If you open the .edmx file and right-click in an empty space, there's an option to Update Model from Database which will find tables and columns that have changed. I think you'll have to run your T4 code generation again after updating the model (haven't used T4 myself, so I'm not sure).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top