数据行类型检测时使用的XSD生成的数据集 [英] Data Row Type detection when using XSD generated DataSets

查看:314
本文介绍了数据行类型检测时使用的XSD生成的数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个XML Schema定义在Visual Studio 2010中的DataSet设计器的生成一个强类型数据集中的 <名称> .designer.vb 文件

I have an XML Schema Definition (XSD) file in Visual Studio 2010. The DataSet Designer generates a strongly typed dataset in the <name>.designer.vb file

根据一些错误的因素,似乎偶尔为枚举操作强类型(在LINQ或者每个循环使用)

Depending on a number of errant factors, it seems to sporadically provide strong typing for enumerable operations (used in LINQ or for each loops)

有关例如,有时产生code基是能够检测的类型,有时它不是

For instance, sometimes the generated code base is able to detect the type, and sometimes it's not:

的违规code似乎是被生成的文件是否具有功能:

The offending code seems to be whether or not the generated file has the function:

Public Overridable Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
    Return Me.Rows.GetEnumerator
End Function

如果是这样,然后调用枚举函数会返回一个无聊的对象
如果没有,那么枚举将返回相应的类型。

If it does, then calling the enumerator for the function will return a boring object.
If it doesn't, then the enumerator will return the appropriate type.

我们的源$ C ​​$ C不含产生code,所以每个开发人员需要生成它自己。这导致一些机器获得不当打字编译器错误,而其他人不...用的完全相同的源$ C ​​$ C 的。

Our source code doesn't contain generated code, so each developer needs to generate it for themselves. This results in some machines getting compiler errors with improper typing, while others don't... with the same exact source code.

这似乎有一些东西有些东西用它做:

Some things that appear to having something to do with it:

  • 在大会版本针对.NET 4.0 VS .NET 4.0客户端
  • 不管是不是XSD,设计师,或使用的文件是开放的生成过程中
  • 其他?
  • 在包括强类型/所有声明铸造
  • 包含正确的源代码控制生成的文件

推荐答案

总之,当 MSDataSetGenerator 工具运行,但 System.Data.DataSetExtensions 组件有问题发生尚未加载到当前的Visual Studio过程。

The Problem:

In short, the problem occurs when the MSDataSetGenerator tool runs, but the System.Data.DataSetExtensions assembly has not yet been loaded into the current Visual Studio process.

要加载程序集的一个方法就是打开任何XSD文件和然后的重新生成设计code。

One way to load the assembly is just to open any XSD file and THEN re-generate the designer code.

下面的步骤应该产生相应的设计文件:

The following steps should generate the appropriate designer file:

  1. 打开任何XSD文件到设计视图(这个负载 DataSetExtensions.dll
  2. 右键点击XSD和选择运行自定义工具
  1. Open any XSD file to the designer view (this loads DataSetExtensions.dll)
  2. Right Click on the XSD and Select Run Custom Tool

下面是一个完整的一步一步的演练与问题和解决办法的照片

Here's a full step by step walkthrough with pictures of the issue and solution

此问题已得到以下错误门票报告给微软:

This problem has been reported to Microsoft in the following bug tickets:

  • #668724 - MSDataSetGenerator generates incorrect output sometimes
  • #733077 - MSDataSetGenerator does not generate TypedTableBase derived classes

这也是解决中的SO问题:

It is also addressed in the SO Question:

这篇关于数据行类型检测时使用的XSD生成的数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆