Is there an easy way to compose an object from other objects?

114 views Asked by At

Is there an easy way to compose an object based on other objects? i am thinking the solution lies using DI container & Interfaces eg.

public IObjectA : IObjectB, IObjectC {...}

public ObjectA CreateObjectA()
{
 ObjectB b = new ObjectB();
 ObjectC c = new ObjectC();
 return container.GetExportedValues<IObjectA>(b,c);
}

The whole idea is not to write any mapping code to create an object.

0

There are 0 answers