我正在使用 Visual Studio 2010 和 ADO.Net 实体数据模型来创建我的数据库架构。由于我仍在起草和讨论架构,我希望能够将示例数据添加到 edmx 文件中,并能够在设计器中显示它,如下面的屏幕截图所示:
添加示例数据的 EDMX 文件源代码
底层 xml 代码将包含正常的 edmx 输出,并在顶部包含如下示例数据:
<?xml version="1.0" encoding="utf-8"?>
....
<EntityType Name="Title">
<Documentation>
<Summary>Table titles contains all the dvd-title we have in our store</Summary>
</Documentation>
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Type="Int32"
Name="Id" Nullable="false"
annotation:StoreGeneratedPattern="Identity" />
<Property Type="String" Name="Title" Nullable="false" >
<Documentation>
<Summary>The title of the movie</Summary>
<LongDescription>
The translated title of the movie and the original title
</LongDescription>
</Documentation>
</Property>
</EntityType>
<Titles>
<Title>
<id>810</id>
<title>Pulp Fiction</title>
<year>1994</year>
</Title>
<Title>
<id>940</id>
<title>Lock, Stock and Two Smoking Barrels</title>
<year>1998</year>
</Title>
</Titles>
样本数据应该显示出来并且应该在设计视图中是可编辑的。
有谁知道组合 edmx 文件并显示和添加示例数据的工具或方法?
奖励问题:当我生成 sql 语句时,文档不会添加到 sql 语句中。有没有办法包含字段和表格的文档,以便将它们添加到 Microsoft SQL Server?