Redian新闻
>
MVC Project 如何利用EF(reverse model) Data Binding 已有的数据库?
avatar
MVC Project 如何利用EF(reverse model) Data Binding 已有的数据库?# DotNet - 窗口里的风景
w*7
1
You can use "Entity Framework" to create a model from a database, WPF and
Window Form can consume this model. I am not sure about Webform (I think it
could).
But for MVC, the reverse engineering model is used ObjectSet and Objectquery
, Is there any way to implement the model directly in MVC as Data Domain?
Or you have to use code first to build the data model and set connectting
string to direct connect to database?
avatar
H*g
2
Data Respository
LLBLGEN FTW
avatar
k*i
3
POCO

it
Objectquery

【在 w*******7 的大作中提到】
: You can use "Entity Framework" to create a model from a database, WPF and
: Window Form can consume this model. I am not sure about Webform (I think it
: could).
: But for MVC, the reverse engineering model is used ObjectSet and Objectquery
: , Is there any way to implement the model directly in MVC as Data Domain?
: Or you have to use code first to build the data model and set connectting
: string to direct connect to database?

avatar
w*7
4
According to Julie's blog, if you use EF5 and VS2012, you can "uses a code
generator that spits out POCO entity classes managed by a DbContext by
default rather than the EntityObject based classes managed by the
ObjectCpntext as it did for VS2008 and VS2010."
http://thedatafarm.com/blog/data-access/getting-started-with-ef
I used "code first" to build a db and use "DB first" to reverse-engineering
a model (You can use such as model.tt to rebuild you data model) and
compared with previous class, basically you can not directly to use them (no
annotation etc...).
But it gives you a reference to build "code first" model, I think so far "
code first" should be first choose for your MVC project.

【在 k****i 的大作中提到】
: POCO
:
: it
: Objectquery

avatar
k*i
5
Tool肯定有,免费的收费的自己找找。
除非你有很多existing tables.I prefer to write the POCO classes myself.

engineering
no

【在 w*******7 的大作中提到】
: According to Julie's blog, if you use EF5 and VS2012, you can "uses a code
: generator that spits out POCO entity classes managed by a DbContext by
: default rather than the EntityObject based classes managed by the
: ObjectCpntext as it did for VS2008 and VS2010."
: http://thedatafarm.com/blog/data-access/getting-started-with-ef
: I used "code first" to build a db and use "DB first" to reverse-engineering
: a model (You can use such as model.tt to rebuild you data model) and
: compared with previous class, basically you can not directly to use them (no
: annotation etc...).
: But it gives you a reference to build "code first" model, I think so far "

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。