Skip to content
Cy Scott edited this page Oct 17, 2021 · 3 revisions

MGen MGen

NuGet Badge

MGen is a code generator library that can generate C# classes from interfaces.

Simple Exmaple

The first thing you will need to do is to install the MGen NuGet packages.

Install-Package MGen
Install-Package MGen.Abstractions

Here is a simple example of how it works:

[Generate]
public interface IHaveAnGuidId
{
    Guid Id { get; set; }
}

The generated code will look like:

public class HaveAnGuidIdModel : IHaveAnGuidId
{
    public System.Guid Id
    {
        get
        {
            return _Id;
        }
        set
        {
            _Id = value;
        }
    }
    private System.Guid _Id;
        
    public HaveAnGuidIdModel()
    {
    }
        
}

For a full list of supported features read this.

Icon Created By

Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 B

Clone this wiki locally