如何“从数据库更新模型”编程? [英] How to "Update Model From Database" programatically?
问题描述
我从一个EF 6数据库首先使用EDMX文件两个特定的列。
该项目是每个月部署一次的网站。
如果我在这些列中进行一些更改(从数据库),我只是执行从数据库更新模型...命令及其罚款。 >
我的问题是...
有没有办法在global.asax中编程检查数据库是否已更改,然后自动更新这些列的映射?
这是一个困难和漫长的路要走,你需要更新存储模式(SSDL),但可以执行。这是一个很好的资源,将帮助您开始
http://blogs.msdn.com/b/dbrowne/archive/2013/08/30/entity-framework-schema-redirection.aspx
I started with an EF 6 Database First using an EDMX file for two specific columns.
The project is a website which is deployed once each month.
If I make some changes in these columns(from the database), I just execute the "Update Model From Database..." command and its fine.
My question is...
Is there a way to check programatically in the global.asax if the database has changed, and then update the mappings for these columns automatically?
It's a difficult and long way to go where you'll need to update the store schema (SSDL), but doable. Here's good resource that will help you start
http://blogs.msdn.com/b/dbrowne/archive/2013/08/30/entity-framework-schema-redirection.aspx
这篇关于如何“从数据库更新模型”编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!