1

I have a block of XML in a database which is easy enough to pull out using ASP.NET MVC, however I would like to access and modify the XML in an way more consistent with class instances. Is there a way to get the MVC (or any other model) to generate a data access (or perhaps Entity) class set from the DB-stored XML?

If the above is rather obtuse, the question could be summarised as; What method would you use to best access and modify XML stored in a database from an ASP.NET MVC application?

2
  • What are you using to access the database ? Linq2sql, Linq2entities or some other ORM tooling ? Commented Jan 21, 2010 at 9:40
  • I'm happy to go with Entity or Linq2Sql - and happy to take advice on that too... Commented Jan 21, 2010 at 10:53

1 Answer 1

3

The method I went with in the end was simply to use LINQ2SQL to get the data from the SQL2005 DB and then pass the field value into XElement.Parse() to get an XML object I can easily work with. Manipulating the XML was the done using the information gained from helpful overflowers here:

How do I insert an element into XML using Linq?

How to add attributes to an element using LINQ, C#?

How to sort XML in LINQ C# by an attribute value? Also MVC

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.