动态数据,无需数据库和模型更新
我得出的结论是,如果只需从模型或数据库的一侧实现模型更改,那么非常漂亮的 ASP.NET 动态数据框架会更加漂亮。现在,如果我添加列或表,我必须刷新我的 EF 模型,然后脚手架会完成这些肮脏的工作。
我更喜欢一种机制,可以更新我的 EF 模型,并将更改推送回数据库,或者更新我的数据库并以编程方式更新我的 EF 模型。如果没有 Visual Studio,现场原型制作将会很棒。只需添加一栏并点击该网站即可。
有没有任何项目可以处理这个问题?如果没有,我应该从哪里开始学习我提到的其中一种或两种方法?
I have come to the conclusion that the very nifty ASP.NET Dynamic Data framework would be even more nifty if one only had to implement model changes from one side, model or DB. Right now, if I add a column or table, I must refresh my EF model, and then the scaffolding does the dirty work.
I would much prefer a mechanism where I can update my EF model, and have changes pushed back to the DB, or update my DB and programmatically update my EF model. Prototyping on site, without Visual Studio, would be amazing. Just add a column and hit the site.
Are there any projects that deal with this? If not, where should I start looking to learn about either or both of the approaches I mention?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在使用 .NEt 4.0,您应该查看 仅限代码。
它不仅允许您在代码中创建模型(即无需 EDMX),还允许您将模型部署到数据库,如下所示:
请参阅此 提示了解更多信息
虽然 Code-Only 并未作为 .NET 4.0 的一部分提供,但支持此 CreateDatabase 方案的函数正在从 Code-Only 移至 .NET 4.0。
.NET 4.0 Beta2 发布时并没有发生这种情况,因此您必须下载仅代码位才能使其在 Beta2 上运行。
但是,当 .NET 4.0 RTM 出现时,CreateDatabase() 函数将出现在框中。
希望这对
亚历克斯有帮助
If you are working against .NEt 4.0 you should look at Code-Only.
Not only does it allow you to create your models in code (i.e. without an EDMX) it also allows you to deploy your model to a database, like this:
See this tip for more
While Code-Only is not shipping as part of .NET 4.0, the functions that support this CreateDatabase scenario are being moved from Code-Only into .NET 4.0.
That hadn't happened when .NET 4.0 Beta2 shipped, so you have to download the Code-Only bits to get this to work against Beta2.
But when .NET 4.0 RTMs the CreateDatabase() functions will be in the box.
Hope this helps
Alex