在xsd文件中自动生成元素注释



我正在开发一个工具,当我们的xsd模式文件发生变化时,它可以自动更新我们的类型化数据集。我注意到,当我将xsd文件添加到Visual Studio并在设计视图中打开它时,如果我更改一个属性并保存,xsd文件就会发生实质性的变化。基本上,每个元素都添加了大量注释。例如:

<xs:element name="EventWeather">

变成如下:

<xs:element name="EventWeather" msprop:Generator_TableClassName="EventWeatherDataTable" msprop:Generator_TableVarName="tableEventWeather" msprop:Generator_RowChangedName="EventWeatherRowChanged" msprop:Generator_TablePropName="EventWeather" msprop:Generator_RowDeletingName="EventWeatherRowDeleting" msprop:Generator_RowChangingName="EventWeatherRowChanging" msprop:Generator_RowEvHandlerName="EventWeatherRowChangeEventHandler" msprop:Generator_RowDeletedName="EventWeatherRowDeleted" msprop:Generator_RowClassName="EventWeatherRow" msprop:Generator_UserTableName="EventWeather" msprop:Generator_RowEvArgName="EventWeatherRowChangeEvent">

问题是,如果不将这些注释添加到xsd文件中,则xsd.exe生成的结果类型化数据集代码不会编译,并给我一个错误,说数据集已经包含了生成的类型之一的定义。我希望能够自动将这些注释添加到xsd文件中,而不必在Visual Studio中打开它,但没有找到任何相关信息。

有人知道我如何利用这个xsd更新功能从visual studio使用命令行吗?我的xsd文件非常大,所以不能手动添加这些文件。

VisualStudio将重写XSD、WSDL或任何它认为合适的XML文件。很多是告诉设计视图如何显示数据。这些额外的东西只是额外的数据让VS施展它的魔力

最新更新