ipjohnson / Grace

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

Add the idea of TryAs(Type, out bool success) #44

Closed ipjohnson closed 7 years ago

ipjohnson commented 8 years ago
bool success;

c.Export(typeof(BasicService)).TryAs(typeof(IBasicService), out success);

Only exports BasicService if no other IBasicService exist.

Also need to add a TryByInterface and TryByInterfaces to ExportTypeSetConfiguration

ipjohnson commented 7 years ago

I'm going to move this back to 6.3.0 and rethink the method to be more like Autofac

ipjohnson commented 7 years ago

After looking at the implementation for autofac I'm going to mirror the IfNotRegistered and OnlyIf methods