4

Is it possible to automatically convert a lot of C# classes to SQL Server database tables ?

I need to import some xml files into SQL Server but using SSIS the runtime stops working as soon as I select the xsd file. However I easily converted the xsd to class files so that's why I am asking if its possible to have a workaround...

3

3 Answers 3

5

You can use Entity Framework Code First functionality, with a little extra work to get the tables done in your database.

There you have a good post on it by ScottGu

Sign up to request clarification or add additional context in comments.

Comments

3

Yes, it's possible to automatically do this. Entity Framework has a model called Code First, which essentially does this: takes your C# classes and creates the database and tables automatically for you.

Take a look at this post by Scott Guthrie.

Comments

0

Other option you might test is DataSet.ReadXml() function. Drawback is the Dataset can't handle complexType="mixed", but it deals well with large files (my files had about 50M each). All tables and columns are named by XML tags and relations are autogenerated by DataSet itself.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.