从实体框架模型构建数据库模式 [英] Building DB schema from Entity Framework Model

查看:89
本文介绍了从实体框架模型构建数据库模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到,EF可以根据现有的数据库模式来更新模型。但是,我从头开始,我不想在EF模型文件中构建表格,然后重新构建它们。有没有办法我可以绘出一个模型文件,并自动为我创建SQL表?

解决方案

不幸的是,你必须等待EF的版本2。



这是与EF团队博客的链接,他们谈论在v2中添加Model First支持:


实体框架V1中最痛苦的遗漏之一是Model First,这基本上意味着创建概念模型,然后从中导出存储模型,数据库和映射。 / p>

[...]



下一个版本的实体框架将包括生成数据库模式的能力,你的模特儿此功能的主要入口点是通过Designer上下文菜单,我们将添加一个名为从模型创建数据库的新选项。



I see that EF can update a model based on an existing database schema. However, I'm starting totally from scratch; I don't want to build tables, then rebuild them in the EF model file. Is there a way that I can draw out a model file, and have the SQL tables automatically be created for me?

解决方案

Unfortunately, you have to wait for version 2 of EF.

Here is a link to the EF team's blog, where they talk about adding Model First support in v2:

One of the most painful omissions from the Entity Framework V1 was Model First, which basically means creating a conceptual 'model first' and then deriving a storage model, database and mappings from that.

[...]

The next release of the Entity Framework will include the ability to generate database schemas from your model. The main entry point into this feature is via the Designer context menu, to which we will add a new option called "Create Database from Model".

这篇关于从实体框架模型构建数据库模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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