Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.19 KB

File metadata and controls

28 lines (20 loc) · 1.19 KB

DGML builder that creates visualization of your DbContext and Entities

Nuget

Adds the AsDgml() extension method to any derived DbContext.

The method will create a DGML graph of your DbContext Model, that you can then view in the Visual Studio DGML viewer.

You can add code like this to in a Unit Test or similar to create the diagram:

    using (var myContext = new MyDbContext())
    {
        var path = Path.GetTempFileName() + ".dgml";
        File.WriteAllText(path, myContext.AsDgml(), Encoding.UTF8);
        var startInfo = new ProcessStartInfo(path)
        {
            UseShellExecute = true,
        };
        Process.Start(startInfo);
    }

This code sample demonstrates using AsDgml to generate a dgml of the context when you invoke an ASP.NET Core controller.

Feedback

Please report any issues, questions and suggestions here