Skip to content

Instantly share code, notes, and snippets.

@raghuramn
Created June 26, 2013 01:27
Show Gist options
  • Save raghuramn/5864013 to your computer and use it in GitHub Desktop.
Save raghuramn/5864013 to your computer and use it in GitHub Desktop.
public static IEdmModel GetEdmModel(this DbContext context)
{
using (MemoryStream stream = new MemoryStream())
{
using (XmlWriter writer = XmlWriter.Create(stream))
{
EdmxWriter.WriteEdmx(context, writer);
writer.Close();
stream.Seek(0, SeekOrigin.Begin);
using (XmlReader reader = XmlReader.Create(stream))
{
return Microsoft.Data.Edm.Csdl.EdmxReader.Parse(reader);
}
}
}
}
@AdamCaviness
Copy link

@raghuramn, Could we get a new sample of this that works with the latest bits on MyGet (EdmLib 6.4)? I arrived here via this work item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment