简体   繁体   中英

Create XSD from database programmatically in C#

My DB schema has matured a lot. The XSD had increased in size and hence using Visual Studio 2008 designer is getting difficult. Is there a way I can automate the XSD generation?

I have done this in previous lives using the catalog stored procedures that would list all tables, columns and indices, and run the resulting dataset against a templating engine (homebrewed at the time, but Codesmith would fit the bill 100%, or a clever xslt transform).

Here are the stored procs you can use : http://msdn.microsoft.com/en-us/library/ms182764.aspx

You can then either do the transform in-process or export the whole dataset to xml.

Cheers!

假设您在谈论数据集,您能否将所有内容拖到设计器表面上?

Altova XmlSpy has build-in functionality to convert a database structure to a kind of XSD. It might not be what you need, though.

Found this tool while trying to solve a different problem.

Download: http://sourceforge.net/projects/mygeneration/

XSD Template: http://www.mygenerationsoftware.com/TemplateLibrary/Archive/?guid=59a03408-c96f-4baf-8171-b6bfe8725dab

Fairly simple.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM