Entity Framework – export your context as xml

Ever wanted to export your context as XML and get a representation of what is contained in it’s local view or with all linked properties even if not already loaded in your context.

  • create an entity
  • add it to the context
  • get it’s xml representation.
Author cedric = new Author() { 
                    FirstName = "Cedric", 
                    LastName = "Dumont" 

string s = await appContext.AsXmlAsync();

  • will result in :
  • to do this, you will need this

PM> Install-Package CExtensions.EntityFramework -Pre

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s