为什么要使用实体框架codefirst,如果它不能在生产中安全使用之类索引不能说明 [英] Why should I use Entity Framework codefirst if it can't be used in production safely and things like indexes can't be described

查看:174
本文介绍了为什么要使用实体框架codefirst,如果它不能在生产中安全使用之类索引不能说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚起步的一个非常大的网络项目,并真正想要做的一切权利。

I'm just starting out an extremely large web project, and really trying to do everything right.

使用至今我的工具


  • ASP.NET MVC 3

  • 实体框架4.3

  • Ninject 3

一切都进展顺利,但我发现实体框架codeFirst有点粗略。

All is going well, but I'm finding a few things with Entity Framework CodeFirst a bit sketchy.

例如,我不得不使用 HTTP://$c$cfirstmembership.$c$cplex.com/ 设置会员信息为code首先设置的一部分。这感觉有点举步维艰将不得不使用这样的一些感受第三方。很显然,我应该是1337足以推出自己的,但我不想贪太多了,从一开始走。运行aspnet_regsql感觉太可怕了,并会迷路每个数据库的更新。无论如何,心动不如上述图书馆工作,这不是太糟糕了。脚手架但是似乎已经打破。

For example, I had to use http://codefirstmembership.codeplex.com/ to setup membership information as part of the code first setup. This feels a bit ropey to have to use something third party of this. Obviously I should be 1337 enough to "roll my own" but I don't want to bite off too much from the get go. Running aspnet_regsql feels horrible, and will get lost with each db update. Anyway, got it all working with the above library and it's not too bad. Scaffolding seems to have broken however.

现在超越这一切,现在看来,这个东西是怎么回事,当我在现场环境中正在运行成为probamatic。任何架构的改变,我会想dev的分贝和现场分贝之间,以将不得不手动脚本无论如何管理,因此在这一点上我是不是失去code点第一?

Now beyond all this, it now seems that this stuff is going to become probamatic when I am running in the live environment. Any schema changes I'm going to want to make between the dev db and live db will have to be manually managed with scripts anyway, so at that point am I not losing the point of code first?

我一直在使用谷歌应用程序引擎的最后一年,并希望code首先会以同样的方式基本上是工作?也就是说,进行修改和他们修改实时数据。现在我认为,由于没有在应用程序引擎做剧烈重构,它基本上不会损害生产什么。所以,你永远无法与AppEngine上重命名表。它总是会创建一个新表,并保留旧的。你将不得不手动端口的数据。

I've been working with Google App Engine for the last year, and was hoping that code first would essentially work in the same way? Ie, make changes and they modify the live data. Now I assume, due to not having done severe refactoring in app engine, that it basically doesn't harm anything in production. So you could never rename a table with AppEngine. It would always create a new table, and leave the old one. You would have to manually port data.

所以我现在的想法。为什么不干脆去数据库第一?我一直在与LINQ2SQL 3年,非常舒适的第一个要去分贝。虽然TBH我的数据库的源代码控制stratergy已经有点....欠缺。所以我希望code首先将强制执行情况会有所改善,但它确实使我感到我应该先去DB,只是严格关于保持它在控制之下。

So I'm now thinking. Why not just go Database first? I've been working with linq2sql for 3 years and very comfortable with going db first. Although TBH my db source control stratergy has been a little....lacking. So I was hoping code first would enforce that situation to improve, but it actually makes me feel that I should go DB first, and just be strict about keeping it under control.

我真的AP preciate对这种情况有什么想法,而且,如何与此相比,使用Nhibinate?

I would really appreciate any thoughts on this kind of situation, and also, how does this compare to using Nhibinate?

推荐答案

该升级方案的你描述EF-迁移正在增加。这样做的上线版本已上市,它应该作为一个正式支持的发行版本很快变得可用。

The upgrade scenario's you're describing are being added in EF-Migrations. The go-live release of this is already available and it should become available as a officially supported release version soon.

查看:<一href=\"https://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx?Redirected=true\">https://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx?Redirected=true

退房: http://coding.abel.nu/tag/ef-migrations/

这篇关于为什么要使用实体框架codefirst,如果它不能在生产中安全使用之类索引不能说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆