简体   繁体   English

XML,xsd.exe,自定义类很长

[英]long to xml, xsd.exe, custom classes

I have 3 classes that map to my database. 我有3个类映射到我的数据库。 I need to insert an xml file into the database via these classes. 我需要通过这些类将xml文件插入数据库。 The xml and classes are structured differently. xml和类的结构不同。 Should I use xsd.exe to generate the classes of the xml and then map these generated classes to my database classes? 我应该使用xsd.exe生成xml的类,然后将这些生成的类映射到我的数据库类吗? Or should I use linq to xml to directly map the xml to the classes. 还是应该使用linq到xml直接将xml映射到类。

My experiences with XSD were that if it works for what you are using it for, its a very convenient thing, and completely worth doing. 我在XSD上的经验是,如果XSD能够满足您的使用目的,那么这将是一件非常方便的事情,并且完全值得这样做。

On the other hand though, Depending on how familiar you are with using linq, you will probably end up with a better overall solution if you write the conversion directly. 但是,另一方面,根据您对linq的熟悉程度,如果直接编写转换,可能会得到更好的总体解决方案。

XSD can be very convenient but I'm not always a fan of how the results are spat out. XSD可能非常方便,但我并不总是喜欢结果如何显示。 Overall Personally I'd lean towards using linq. 总体而言,我个人倾向于使用linq。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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