Hi,
I have razor class library and inside this I have DI registered in Umbraco builder. This razor class library is dynamically refer in main web application. When I run web application the razor class library DI is not resolved
The dependencies are registered in razor class library
public class FileWatcherComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddScoped<IFileWatcherService, FileWatcherService>();
}
}
Its showing Unable to resolve the dependency IFileWatcherService when its invoked
But its working when the razor class library is refer in main web app directly (add project reference). But its not working when its loaded at runtime (dynamically loaded assembly - ApplicationPartManager)
If you are loading at runtime then the composer will not run. Are you loading at run time for a specific reason? If so you will need to register the service differently
Umbraco composer in razor class library
Hi, I have razor class library and inside this I have DI registered in Umbraco builder. This razor class library is dynamically refer in main web application. When I run web application the razor class library DI is not resolved
Anyone have idea to handle this?
how exactly are registering it?
Hi Reddick,
The dependencies are registered in razor class library
That should be fine, what is the error you are getting, if any?
Its showing Unable to resolve the dependency IFileWatcherService when its invoked But its working when the razor class library is refer in main web app directly (add project reference). But its not working when its loaded at runtime (dynamically loaded assembly - ApplicationPartManager)
If you are loading at runtime then the composer will not run. Are you loading at run time for a specific reason? If so you will need to register the service differently
Yes, When I run my web application it should read (dynamically loaded) the razor class library dll and update the Umbraco web app to use external app.
Does this help?
https://stackoverflow.com/questions/49262766/c-sharp-dependency-injection-runtime-dynamic-registration
This may be of use
https://docs.umbraco.com/umbraco-cms/reference/plugins
is working on a reply...