ipjohnson / Grace

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

Grace.Factory was only working with int constructor arguments #117

Closed sonofaforester closed 7 years ago

ipjohnson commented 7 years ago

Good catch, sorry about that. I'll merge this in tonight. Do you want another beta?

sonofaforester commented 7 years ago

Another beta would be great. The other problem I'm running into currently is that with ninject, we were able to inject the factory interface into objects created by the factory. With Grace, I'm getting a Recursive object graph exception. I'm wondering if the factory's lifetime should be Singleton to solve this?

ipjohnson commented 7 years ago

@sonofaforester Grace usually doesn't allow recursive calls like that (outside of using Lazy<T>). That said because there is a special DynamicFactoryStrategy it will be easy to support.

I'm going to update the code to put the newly created factory instance into the IInjectionContext, then later when the factory is needed as a dependency to it's children it will be fetched from the context rather than trying to instantiate a new one.

I'll make the changes later today or tomorrow and do a beta release.