惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
V
V2EX
The GitHub Blog
The GitHub Blog
T
Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
A
Arctic Wolf
Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
W
WeLiveSecurity
Cloudbric
Cloudbric
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
T
The Exploit Database - CXSecurity.com
U
Unit 42
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy
Hugging Face - Blog
Hugging Face - Blog
O
OpenAI News
N
News and Events Feed by Topic
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
博客园 - 聂微东
V
Visual Studio Blog
美团技术团队
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
小众软件
小众软件
Engineering at Meta
Engineering at Meta
NISL@THU
NISL@THU
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
Martin Fowler
Martin Fowler
T
Troy Hunt's Blog

博客园 - micenter

Register ASP.NET 4.0 An error has occurred: 0x8007b799 You must have administrative rights on this machine in order to ru 记录一些常用的SQLServer时间日期函数详解 IT民工的2013生活创想 SQL 日志太大,脚本清除 跟随博客园进入2012 .NET 中 操作excel 系列--copy功能. .NET 中 操作excel 系列--导入与导出. 设置VSS2005使支持通过Internet访问 中the server configuration settings apply only for local databases....问题解决 vss 2005 配置服务器端的时候提示"IIS没有安装" ASP.NET MVC 实现二级域名 [转] Eclipse快捷键大全(转载) Android单元测试测试[转] InnoDB ,MyISAM 等存储引擎中主外键的大小设置. 在 mysql 中 定义 数据库,表,列时,设定的各个的编码格式。 asm.jar 等包的重用问题之解决方案 汇总 Hibernate 与 jdbc,jndi+dbcp, proxool ,c3p0 连接池的配置 - micenter Hibernate中自动增长列的 在Annotations 中的配置和数据库设置默认值问题 - micenter java 字符串的编码与C#的区别 - micenter - 博客园 Hibernate中自动增长列的..hbm.xml 配置和数据库设置默认值问题 - micenter - 博客园
手动使用EDM 生成器 (EdmGen.exe) 工具生成 SSDL,CSDL,MSL 文件。
micenter · 2010-11-10 · via 博客园 - micenter

  在ADO.NET entity Framework中可通过VS工具可视操作生成,概念架构定义语言 (CSDL)、存储架构定义语言 (SSDL) 和映射规范语言 (MSL) 文件,但有时候也要手动的去操作一下,在网上找到一操作说明,点击这里可以查看原文 。其中主要的 model 和参数如下:

使用 EdmGen.exe 工具时,必须指定以下模式之一。

模式 说明

/mode:ValidateArtifacts

验证 .csdl、.ssdl 和 .msl 文件并显示所有错误或警告。

此选项需要至少一个 /inssdl/incsdl 参数。如果指定 /inmsl,则还需要 /inssdl/incsdl 参数。

/mode:FullGeneration

使用 /connectionstring 选项中指定的数据库连接信息,生成 .csdl、.ssdl、.msl、对象层和视图文件。

此选项需要一个 /connectionstring 参数,以及一个 /project 参数或 /outssdl/outcsdl/outmsl(注:不是outmsdl)、/outobjectlayer/outviews/namespace/entitycontainer 参数。

/mode:FromSSDLGeneration

根据指定的 .ssdl 文件生成 .csdl 和 .msl 文件、源代码和视图。

此选项需要 /inssdl 参数,以及 /project 参数或 /outcsdl/outmsl/outobjectlayer/outviews/namespace/entitycontainer 参数。

/mode:EntityClassGeneration

创建包含根据 .csdl 文件生成的类的源代码文件。

此选项需要 /incsdl 参数,以及 /project 参数或 /outobjectlayer 参数。/language 参数是可选的。

/mode:ViewGeneration

创建包含根据 .csdl、.ssdl 和 .msl 文件生成的视图的源代码文件。

此选项需要 /inssdl/incsdl/inmsl,以及 /project/outviews 参数。/language 参数是可选的。

 选项

选项 说明

/p[roject]:<字符串>

指定要使用的项目名称。项目名称用作命名空间设置、EDM 文件名、对象源文件名、视图生成源文件名的默认值。实体容器名称设置为 <项目>Context。

/prov[ider]:<字符串>

用于生成存储模型 (.ssdl) 文件的 .NET Framework 数据提供程序的名称。默认提供程序是用于 SQL Server 的 .NET Framework 数据提供程序 (System.Data.SqlClient)。

/c[onnectionstring]:<连接字符串>

指定用于连接数据源的字符串。

/incsdl:<文件>

指定 .csdl 文件或 .csdl 文件所在的目录。此参数可多次指定,这样可以指定多个目录或 .csdl 文件。当概念模型跨多个文件拆分时,对于生成类 (/mode:EntityClassGeneration) 或视图 (/mode:ViewGeneration),指定多个目录十分有用。如果希望验证多个模型 (/mode:ValidateArtifacts),这样做也很有用。

/refcsdl:<文件>

指定用于解析源 .csdl 文件中的任何引用的其他 .csdl 文件。(源 .csdl 文件是 /incsdl 选项指定的文件)。/refcsdl 文件包含源 .csdl 文件所依赖的类型。此参数可多次指定。

/inmsl:<文件>

指定 .msl 文件或 .msl 文件所在的目录。此参数可多次指定,这样可以指定多个目录或 .msl 文件。当概念模型跨多个文件拆分时,对于生成视图 (/mode:ViewGeneration),指定多个目录十分有用。如果希望验证多个模型 (/mode:ValidateArtifacts),这样做也很有用。

/inssdl:<文件>

指定 .ssdl 文件或 .ssdl 文件所在的目录。

/outcsdl:<文件>

指定将创建的 .csdl 文件的名称。

/outmsl:<文件>

指定将创建的 .msl 文件的名称。

/outssdl:<文件>

指定将创建的 .ssdl 文件的名称。

/outobjectlayer:<文件>

指定包含根据 .csdl 文件生成的对象的源代码文件的名称。

/outviews:<文件>

指定包含所生成的视图的源代码文件的名称。

/language:[VB|CSharp]

指定生成的源代码文件的语言。默认语言为 C#。

/namespace:<字符串>

指定要使用的命名空间。命名空间是在运行 /mode:FullGeneration/mode:FromSSDLGeneration 时在 .csdl 文件中设置的。在运行 /mode:EntityClassGeneration 时不使用该命名空间。

/entitycontainer:<字符串>

指定在生成的 EDM 文件中应用于 <EntityContainer> 元素的名称。

/help?

显示工具的命令语法和选项。

/nologo

禁止显示版权信息。

       如果你想从SQLSERVER 数据库中生成.ssdl,cdsl,msl 文件 可使用如下命令:>EdmGen /mode:FullGeneration   /connectionstring:"server=localhost;user id=admin;password=123456;persist security info=True;database=testDB" /provider:"System.Data.SqlClient" /outssdl:test.ssdl /outcsdl:test.csdl  /outmsl:test.msl /outobjectlayer:testobj.cs /outviews:testview.cs  /namespace:"TestSpace"   /entitycontainer:"Testentitycontainer"或者

去掉 “/provider:"System.Data.SqlClient” 也可以,因为用于生成存储模型 (.ssdl) 文件的 .NET Framework 数据提供程序的名称默认提供程序是用于 SQL Server 的 .NET Framework 数据提供程序 (System.Data.SqlClient)。

    如果你想从MYSQL(测试的mysql是5.0.3版本的) 数据库中生成 .ssdl,cdsl,msl 文件 可使用如下命令:>EdmGen /mode:FullGeneration   /connectionstring:"server=localhost;user id=admin;password=123456;persist security info=True;database=testDB" /provider:"MySql.Data.MySqlClient"
/outssdl:test.ssdl /outcsdl:test.csdl  /outmsl:test.msl /outobjectlayer:testobj.cs /outviews:testview.cs  /namespace:"TestSpace"   /entitycontainer:"Testentitycontainer"
   即可。不过一定要拷文件 MySql.Data.dll,  MySql.Data.Entity.dll, EdmGen.exe.config 和 EdmGen.exe 放在同一文件夹下面。其中EdmGen.exe.config 文件内容为:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
<runtime>
    
<generatePublisherEvidence enabled="false"/>
  
</runtime>
<system.data>
    
<DbProviderFactories>
      
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=92c3c527cdfe7566" />
    
</DbProviderFactories>
  
</system.data>
</configuration>

执行命之后你发现在指定目录下面生成了:test.csdl,test.ssdl ,test.msl, testobj.cs, testview.cs 五个文件,此段工作完成。