ByronMayne / AutoFactories

AutoFactories is a C# library used to generate factories for types to be used in dependency injection.
MIT License
1 stars 0 forks source link

When constructor takes no arguments use default constructor to make the types. #20

Open ByronMayne opened 4 months ago

ByronMayne commented 4 months ago

Whenever creating a type we use Ninject internally to resolve it. However as an enhancment we could default to just creating an new instance.

From:

public global::Foo.ExampleClass Create()
{
    IParameter[] parameters = new IParameter[]
    {
    };
    global::Foo.ExampleClass instance = m_resolutionRoot.Get<global::Foo.ExampleClass>(parameters);
    return instance;
}

To:

public global::Foo.ExampleClass Create()
{
    return new global::Foo.ExampleClass();
}