YairHalberstadt / stronginject

compile time dependency injection for .NET
MIT License
845 stars 24 forks source link

Document Owned<T> support in readme #150

Closed jnm2 closed 2 years ago

jnm2 commented 2 years ago

Documents https://github.com/YairHalberstadt/stronginject/issues/140, implemented in https://github.com/YairHalberstadt/stronginject/pull/149.

@YairHalberstadt I erred on the side of being long-winded. Happy to work on trimming this down if you think it needs it.

jnm2 commented 2 years ago

Well, now I had this idea of saying something like:

When X depends on an instance of Y...

  • Always starting when X is created and always ending when X is disposed ➡ Inject Y
  • Always starting when X is created and possibly ending earlier or later than when X is disposed ➡ Inject Owned<Y>
  • Possibly starting later than when X is created and always ending when X is disposed ➡ Inject Func<Y>
  • Possibly starting later than when X is created and possibly ending or later than when X is disposed ➡ Inject Func<Owned<Y>>