nuPickers icon indicating copy to clipboard operation
nuPickers copied to clipboard

Is there a way to inject dependencies into IDotNetSource classes using Autofac?

Open iahdevelop opened this issue 7 years ago • 2 comments

Hello

I'm using AutoFac in my application to provide dependency management. At the same time i depend heavily on DoNet Typeahead List. The problem is when i registered my Source classes into Autofac container, the dependencies were not resolved?

I tried to replace: object dotNetDataSource = AppDomain.CurrentDomain.CreateInstanceAndUnwrap(Helper.GetAssembly(this.AssemblyName).FullName, this.ClassName);

in the DotNetDateSource class with: var type = Helper.GetAssembly(this.AssemblyName).GetType(ClassName); var themesource = DependencyResolver.Current.GetService(type);

I always get null value.

Any one knows why?

iahdevelop avatar Sep 05 '16 18:09 iahdevelop

I'm also curious if this possible. Currently using service locator to resolve dependencies into a custom nupicker, but I'd prefer to use DI and constructor injection.

Yodablues avatar Jan 23 '17 22:01 Yodablues

I'm not even able to hit the code while using constructor injection. When loading a node in Umbraco with a property using the datatype I get 500 Internal Server Error with the message:

)]}', {"Message":"The requested resource does not support http method 'GET'."}

lindeberg avatar Jan 30 '19 14:01 lindeberg