ipjohnson / Grace

Grace is a feature rich dependency injection container library
MIT License
336 stars 33 forks source link

Change return type of Configure (maybe some extension on alias like .Cfg(_=>...) ) #128

Closed mcdis closed 6 years ago

mcdis commented 6 years ago

At this momebt IInjectionScope::Configure returning void, so I can't create routine that create child, configure them and return in one line. If Configure return IInjectionScope I can do this:

IInjectionScope ConfigSuperBuper(this IShell _this)
 => _this.Container.CreateChildScope().Configure(_ =>_.ExportAs<A,IA>());

but I have to

IInjectionScope ConfigSuperBuper(this IShell _this)
{
   var child = this.Container.CreateChildScope();
   child_.Configure(_ =>_.ExportAs<A,IA>());
   return child;
}
ipjohnson commented 6 years ago

@mcdis I'd be open to changing the return type on configure.

ipjohnson commented 6 years ago

I'm going to close this out in favor of each developer doing C# extensions to implement their own specific flavor for registration