ipjohnson / Grace

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

Safe property injection (auto readonly) before constuctor called #198

Closed mcdis closed 5 years ago

mcdis commented 5 years ago

Hi! I suggest to make that scenario: Inject auto prop get only before constructor called. I didn't look in deep in code, but if you use create uninitialized object then you can inject properties before constructor and make prop injection in safe way. Sometime It's not friendly to drag all dependencies over constructor...for example when I've some hierarchy

ipjohnson commented 5 years ago

Hi @mcdis

I've added an example of how you could auto inject auto properties, but they are injected after the constructor is called. Grace uses linq expressions to build object graphs and there isn't really a new but uninitialized.