在 xsd 文件中自动生成元素注释
Auto-generating element annotations in xsd file
我正在开发一种工具,可以在我们的 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 中打开它,但一直找不到任何相关信息。
有谁知道如何使用命令行从 visual studio 中利用此 xsd 更新功能?我的 xsd 文件非常大,因此无法手动添加这些文件。
VisualStudio 将根据需要重写 XSD、WSDL 或任何 XML 文件。很多是告诉设计视图如何显示数据。这些额外的东西只是 VS 的额外数据,可以用来做它的魔法。
我正在开发一种工具,可以在我们的 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 中打开它,但一直找不到任何相关信息。
有谁知道如何使用命令行从 visual studio 中利用此 xsd 更新功能?我的 xsd 文件非常大,因此无法手动添加这些文件。
VisualStudio 将根据需要重写 XSD、WSDL 或任何 XML 文件。很多是告诉设计视图如何显示数据。这些额外的东西只是 VS 的额外数据,可以用来做它的魔法。