当我们在Microsoft Visual Studio 2005里编写DBC的XML文件时,如果能够智能感知schema该多好啊, 我原来看到别人实现了,还以为是利用代码段实现呢,最近查看SDK,发现只需要按以下步骤操作即可:
1.将BdcMetadata.XSD文件拷贝到xml文件同目录位置或指定BdcMetadata.XSD位置
2.修改schemaLocation,注意下面红色字部分,如果将BdcMetadata.XSD文件拷贝到xml文件同目录位置,则不需做任何修改,如果不是,则需要修改为BdcMetadata.XSD存在的位置.
注意: XSD文件存在于<Root>\Program Files\Microsoft Office Server\12.0\Bin
他能很大程度上简化DBC文件的编写.
<LobSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog BDCMetadata.xsd" Type="Database" Version="1.0.0.1" Name="AdventureWorksDW_ding" xmlns="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">
下面是SDK 里的原话:
The Business Data Catalog provides a schema definition file (XSD) that defines the schema that is allowed in the XML file, which in turn defines the metadata for a business application. The XML documents must adhere to this schema.
You can find the BdcMetadata.XSD file in the \Bin directory
of your Office SharePoint Server 2007 installation, typically at <
Root>\Program Files\Microsoft Office Server\12.0\Bin
.
When you author metadata in Microsoft Visual Studio 2005, copy the XSD to your working folder and set the SchemaLocation attribute in the XML file to point to the schema file. Visual Studio 2005 provides IntelliSense capabilities that greatly simplify editing.