How to make Autofac perform property injection in Orchard CMS?

It's pretty simple - look into the source how it's done with ILogger interfaces and do the same for IOrchardServices The source file is Orchard. Framework/Logging/LoggingModule. Cs It's exactly what you are looking for, I guess Everything is being done via Autofac module (implementation of Autofac.

Module class). What that class does is to: register the implementation of ILogger interfaces ( Load method) and get properties of an processed object and set it's appropriate properties with object resolved from the container ( AttachToComponentRegistration method) Pretty simple. Autofac modules are a nice way to plug into the DI process It would be enough just to copy that source file to your custom Orchard module and changing ILogger to IOrchardServices (and, of course the registered class).

The class I mentioned makes use of factory pattern to create instances, but you can change that to simple object creation via new and get rid of the factory-related things.

It's pretty simple - look into the source how it's done with ILogger interfaces and do the same for IOrchardServices. The source file is Orchard. Framework/Logging/LoggingModule.cs.It's exactly what you are looking for, I guess.

Everything is being done via Autofac module (implementation of Autofac. Module class). What that class does is to: register the implementation of ILogger interfaces (Load method) and get properties of an processed object and set it's appropriate properties with object resolved from the container (AttachToComponentRegistration method).

Pretty simple. Autofac modules are a nice way to plug into the DI process.It would be enough just to copy that source file to your custom Orchard module and changing ILogger to IOrchardServices (and, of course the registered class). The class I mentioned makes use of factory pattern to create instances, but you can change that to simple object creation via new and get rid of the factory-related things.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions