Named and Keyed services (Autofac IIndex) equivalent in LightInject ....
Following from another question I had, I can see Umbraco8 provides the lightinject DI setup. I could possibly switch to use this for basic DI.
What I was particularly struggling with is that I am factory class (pattern) which worked great with AutoFac and the named and keyed services. Autofac adds this to a IIndex.
public TransformFactory(IMyAwesomeContext awesomeContext, IIndex
I had a number of classes implementing ITransform. Within the factory I could then simply do this ... to get at the required object.
switch (nodeTypeAlias.ToLowerInvariant())
{
case "user":
_transforms.TryGetValue("UserTransform", out transformObject);
break;
}
so my question is, how do I do that with lightinject within Umbraco8 ? ...
I am hoping I can stick with Autofac to be consistent with my Umbraco7 project. Will be a little confused if I need to change the DI to sit with lighinject (seeing Umbraco let us use our own DI packages).
Named and Keyed services (Autofac IIndex) equivalent in LightInject ....
Following from another question I had, I can see Umbraco8 provides the lightinject DI setup. I could possibly switch to use this for basic DI.
What I was particularly struggling with is that I am factory class (pattern) which worked great with AutoFac and the named and keyed services. Autofac adds this to a IIndex.
In the DI I had this ...
then in the factory class constructor I had ...
public TransformFactory(IMyAwesomeContext awesomeContext, IIndex
I had a number of classes implementing ITransform. Within the factory I could then simply do this ... to get at the required object.
so my question is, how do I do that with lightinject within Umbraco8 ? ...
I am hoping I can stick with Autofac to be consistent with my Umbraco7 project. Will be a little confused if I need to change the DI to sit with lighinject (seeing Umbraco let us use our own DI packages).
Thanks ...
Matt
is working on a reply...