How do you create a database from an Entity Data Model.
如何从实体数据模型创建数据库。
So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server.
所以我使用VisualStudio 2008中的EDM Designer创建了一个数据库,现在我想生成SQL Server Schema以在SQL Server中创建存储。
5 个解决方案
#1
1
From what I understand you are not just supposed to use EDM as a "pretty" database designer, in fact EDM does not depend on a specific storage layer. It tries to abstract that part for the developer. There are design schemas (CSDL) and storage schemas (SSDL). Anyway, don't mean to lecture you. ;)
根据我的理解,您不仅应该将EDM用作“漂亮”的数据库设计器,实际上EDM不依赖于特定的存储层。它试图为开发人员抽象那部分。有设计模式(CSDL)和存储模式(SSDL)。无论如何,不是故意教你。 ;)
There is EDM Generator, which you use to create models and class, etc.. For a DDL kind of export, I've never done that but what I did was map my EDM to an existing database, which was easier for me to get started.
有EDM生成器,你用它来创建模型和类等。对于DDL类型的导出,我从来没有这样做,但我做的是将我的EDM映射到现有的数据库,这对我来说更容易开始。
There is a great tutorial on MSDN, which details step by step instructions on how to go about using an existing database, but also touches the how to start from scratch approach.
MSDN上有一个很棒的教程,详细介绍了如何使用现有数据库的步骤,还介绍了如何从头开始的方法。
#2
0
The Feature "Generate Database Schema from Model" is scheduled for a future release of Entity Framework. V1 does'nt support schema generatiorn based on EF models.
功能“从模型生成数据库模式”计划用于将来的实体框架版本。 V1不支持基于EF模型的schema generatiorn。
#3
0
I believe the other answers implied this, but just to be explicit - use SSMS (or whatever equivlent if you're a brave sole and not using SQL Server provider) to design the DB layout and then suck that into EDM - and then apply application changes as necessary to the model.
我相信其他答案暗示了这一点,但只是为了明确 - 使用SSMS(或者如果你是一个勇敢的鞋底并且不使用SQL Server提供程序的任何等同物)来设计数据库布局然后将其吸入EDM - 然后应用应用程序根据模型的需要进行更改。
I spent about an hour trying to do it your way first (leftover habit from some other Java ORM tools) - I eventually gave up and now do it the 'Right Way' (tm)
我花了大约一个小时尝试按照你的方式做到这一点(从其他一些Java ORM工具中遗留下来的习惯) - 我最终放弃了,现在做了'正确的方式'(tm)
Eventually it would be nice (as JRoppert indicated) to have the generate databse schema from model feature - then you could get your DDLs for various DB flavours automagically.
最终,从模型特征中获取生成数据库模式会很好(如JRoppert所示) - 然后您可以自动获取各种DB风格的DDL。
#4
0
Generating databases from model is a feature planned for vNext of Entity Framework. Check out this blog post of Entity Framework Design explaining the planned features for database generation from a model.
从模型生成数据库是为实体框架的vNext计划的功能。查看Entity Framework Design的博客文章,解释从模型生成数据库的计划功能。
What you must do right now is either 1) generate the database by hand, or 2) parse the CSDL file and write your own generator. I think option 1) is probably a better option.
你现在必须做的是1)手动生成数据库,或2)解析CSDL文件并编写自己的生成器。我认为选项1)可能是更好的选择。
#5
0
Avilable in EF 4: http://blogs.msdn.com/b/efdesign/archive/2008/09/10/model-first.aspx
在EF 4中可用:http://blogs.msdn.com/b/efdesign/archive/2008/09/10/model-first.aspx
#1
1
From what I understand you are not just supposed to use EDM as a "pretty" database designer, in fact EDM does not depend on a specific storage layer. It tries to abstract that part for the developer. There are design schemas (CSDL) and storage schemas (SSDL). Anyway, don't mean to lecture you. ;)
根据我的理解,您不仅应该将EDM用作“漂亮”的数据库设计器,实际上EDM不依赖于特定的存储层。它试图为开发人员抽象那部分。有设计模式(CSDL)和存储模式(SSDL)。无论如何,不是故意教你。 ;)
There is EDM Generator, which you use to create models and class, etc.. For a DDL kind of export, I've never done that but what I did was map my EDM to an existing database, which was easier for me to get started.
有EDM生成器,你用它来创建模型和类等。对于DDL类型的导出,我从来没有这样做,但我做的是将我的EDM映射到现有的数据库,这对我来说更容易开始。
There is a great tutorial on MSDN, which details step by step instructions on how to go about using an existing database, but also touches the how to start from scratch approach.
MSDN上有一个很棒的教程,详细介绍了如何使用现有数据库的步骤,还介绍了如何从头开始的方法。
#2
0
The Feature "Generate Database Schema from Model" is scheduled for a future release of Entity Framework. V1 does'nt support schema generatiorn based on EF models.
功能“从模型生成数据库模式”计划用于将来的实体框架版本。 V1不支持基于EF模型的schema generatiorn。
#3
0
I believe the other answers implied this, but just to be explicit - use SSMS (or whatever equivlent if you're a brave sole and not using SQL Server provider) to design the DB layout and then suck that into EDM - and then apply application changes as necessary to the model.
我相信其他答案暗示了这一点,但只是为了明确 - 使用SSMS(或者如果你是一个勇敢的鞋底并且不使用SQL Server提供程序的任何等同物)来设计数据库布局然后将其吸入EDM - 然后应用应用程序根据模型的需要进行更改。
I spent about an hour trying to do it your way first (leftover habit from some other Java ORM tools) - I eventually gave up and now do it the 'Right Way' (tm)
我花了大约一个小时尝试按照你的方式做到这一点(从其他一些Java ORM工具中遗留下来的习惯) - 我最终放弃了,现在做了'正确的方式'(tm)
Eventually it would be nice (as JRoppert indicated) to have the generate databse schema from model feature - then you could get your DDLs for various DB flavours automagically.
最终,从模型特征中获取生成数据库模式会很好(如JRoppert所示) - 然后您可以自动获取各种DB风格的DDL。
#4
0
Generating databases from model is a feature planned for vNext of Entity Framework. Check out this blog post of Entity Framework Design explaining the planned features for database generation from a model.
从模型生成数据库是为实体框架的vNext计划的功能。查看Entity Framework Design的博客文章,解释从模型生成数据库的计划功能。
What you must do right now is either 1) generate the database by hand, or 2) parse the CSDL file and write your own generator. I think option 1) is probably a better option.
你现在必须做的是1)手动生成数据库,或2)解析CSDL文件并编写自己的生成器。我认为选项1)可能是更好的选择。
#5
0
Avilable in EF 4: http://blogs.msdn.com/b/efdesign/archive/2008/09/10/model-first.aspx
在EF 4中可用:http://blogs.msdn.com/b/efdesign/archive/2008/09/10/model-first.aspx