D
D
Daniil Martynchuk2013-12-17 21:04:47
SQL
Daniil Martynchuk, 2013-12-17 21:04:47

How to convert Entity framework result from base to xml?

How to easily convert a table using Entity framework connection to xml? Or maybe there is a way to convert an entity table into a DataTable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Supoved, 2013-12-18
@Daniilmar

Banners - a link to an IQueryable database
Banner - a class of objects from the Banners table
----------------------------------

XmlSerializer xsSubmit = new XmlSerializer(typeof(List<Banner>));
var subReq = Banners.ToList();

StringWriter sww = new StringWriter();
XmlWriter writer = XmlWriter.Create(sww);
xsSubmit.Serialize(writer, subReq);
var xml = sww.ToString().Dump();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question