dependency-injectionautofackephas

How is the DI relative to constructor and/or property injection solved in Kephas?


I noticed that most DI frameworks use the constructor approach, but some support also setting dependencies through properties. How does Kephas regard this problem and what built-in means are provided for that? Disclaimer: I think about supporting Autofac, but this depends on my spare time. I saw that something was started in this direction in Kephas, but this seems at the very beginning.


Solution

  • At this point, Kephas is dependent on which DI container you choose. If you are talking about Autofac (as well as MEF/System.Composition), it supports both constructor and property injection. All Kephas service implementation use exclusively the constructor injection, with the notable exception of the Logger property. This is by design, as to inject it through constructor seemed not very nice.