是否有从XSD文件创建VB.NET类的实用程序?

时间:2022-06-01 14:02:57

Is there a utility out there that will create VB.NET classes from a Dataset.xsd file? And I don't mean like the XSD.exe utility does - all that does is convert the XML of an XSD file into classes in a .vb - it doesn't append any "extended" functionality.

是否有一个实用程序可以从Dataset.xsd文件创建VB.NET类?我并不像XSD.exe实用程序那样 - 所有这一切都是将XSD文件的XML转换为.vb中的类 - 它不附加任何“扩展”功能。

I'm basically looking for something that will generate the beginnings of a business layer from the XSD file. Like creating a partial class for each datatable, then create a property for each of the datatable's columns as the right datatype and finally the basically CRUD methods as well.

我基本上是在寻找能从XSD文件生成业务层开头的东西。就像为每个数据表创建一个部分类一样,然后为每个数据表的列创建一个属性作为正确的数据类型,最后创建基本的CRUD方法。

This is something I have to do manually over and over again for each project. (I do lots of little projects and use VistaDB so I can't use Linq-To-SQL - wish I could)

这是我必须为每个项目一次又一次地手动完成的事情。 (我做了很多小项目并使用VistaDB,所以我不能使用Linq-To-SQL - 希望我能)

4 个解决方案

#1


I know this doesn't strictly answer the question, but it looks like VistaDB either does, or will soon, have a provider that can be used with Linq to Entities - see here

我知道这并没有严格回答这个问题,但看起来VistaDB要么或者很快要有一个可以与Linq to Entities一起使用的提供程序 - 请看这里

#2


I think that xsd.exe will do what you need it to. Here's and example to convert purchaseorder.xsd to a vb class in the Purchasing namespace:

我认为xsd.exe会做你需要的。以下是将purchaseorder.xsd转换为Purchasing命名空间中的vb类的示例:

xsd.exe -c -l:vb -n:Purchasing purchaseorder.xsd

Type xsd.exe /? from a visual studio command prompt to get all of the options.

输入xsd.exe /?从visual studio命令提示符获取所有选项。

You can find more info here.

你可以在这里找到更多信息。

#3


Try taking a look at T4 and Code Generation tools in Visual Studio. It's like "writing code that writes code", and it's incredibly powerful.

尝试在Visual Studio中查看T4和代码生成工具。这就像“编写代码编写代码”,而且功能非常强大。

A great video, really an "aha experience" for me http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx

一个很棒的视频,真的是我的“aha体验”http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx

MSDN: http://msdn.microsoft.com/en-us/library/bb126445.aspx

Rob Conery has written an intro: http://blog.wekeroad.com/blog/make-visual-studio-generate-your-repository/

Rob Conery写了一篇介绍:http://blog.wekeroad.com/blog/make-visual-studio-generate-your-repository/

... and so did Scott Hanselman: http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

...... Scott Hanselman也是如此:http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

I understand it's probably not exactly what you're hoping for, but when you want more flexibility and NOT having to write the same code over and over again, it really sounds like T4 could be a solution.

我知道它可能并不完全是你所希望的,但是当你想要更多的灵活性而不必一遍又一遍地编写相同的代码时,听起来真的是T4可能是一个解决方案。

You'll write a template, that analyses your XSD file and generates the vb files directly in your project.

您将编写一个模板,分析您的XSD文件并直接在项目中生成vb文件。

#4


Liquid studio XML Data Binder looks like it does what you want and has a 30 day trial you can download.

Liquid studio XML Data Binder看起来像你想要的,并有30天的试用版,你可以下载。

#1


I know this doesn't strictly answer the question, but it looks like VistaDB either does, or will soon, have a provider that can be used with Linq to Entities - see here

我知道这并没有严格回答这个问题,但看起来VistaDB要么或者很快要有一个可以与Linq to Entities一起使用的提供程序 - 请看这里

#2


I think that xsd.exe will do what you need it to. Here's and example to convert purchaseorder.xsd to a vb class in the Purchasing namespace:

我认为xsd.exe会做你需要的。以下是将purchaseorder.xsd转换为Purchasing命名空间中的vb类的示例:

xsd.exe -c -l:vb -n:Purchasing purchaseorder.xsd

Type xsd.exe /? from a visual studio command prompt to get all of the options.

输入xsd.exe /?从visual studio命令提示符获取所有选项。

You can find more info here.

你可以在这里找到更多信息。

#3


Try taking a look at T4 and Code Generation tools in Visual Studio. It's like "writing code that writes code", and it's incredibly powerful.

尝试在Visual Studio中查看T4和代码生成工具。这就像“编写代码编写代码”,而且功能非常强大。

A great video, really an "aha experience" for me http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx

一个很棒的视频,真的是我的“aha体验”http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx

MSDN: http://msdn.microsoft.com/en-us/library/bb126445.aspx

Rob Conery has written an intro: http://blog.wekeroad.com/blog/make-visual-studio-generate-your-repository/

Rob Conery写了一篇介绍:http://blog.wekeroad.com/blog/make-visual-studio-generate-your-repository/

... and so did Scott Hanselman: http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

...... Scott Hanselman也是如此:http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

I understand it's probably not exactly what you're hoping for, but when you want more flexibility and NOT having to write the same code over and over again, it really sounds like T4 could be a solution.

我知道它可能并不完全是你所希望的,但是当你想要更多的灵活性而不必一遍又一遍地编写相同的代码时,听起来真的是T4可能是一个解决方案。

You'll write a template, that analyses your XSD file and generates the vb files directly in your project.

您将编写一个模板,分析您的XSD文件并直接在项目中生成vb文件。

#4


Liquid studio XML Data Binder looks like it does what you want and has a 30 day trial you can download.

Liquid studio XML Data Binder看起来像你想要的,并有30天的试用版,你可以下载。