When creating a property editor I am getting an error with one of the controllers the error is:
An error occurred when trying to create a controller of type 'UserGroupsApiController'. Make sure that the controller has a parameterless public constructor
The controller inherits from BackOfficeNotificationsController this does not have parameterless constructor only inherited one that must have dependencies injected into it.
So got a bit further with this, I updated automapper to latest version then in my composition I now have:
var config = new MapperConfiguration(cfg => {
cfg.AddProfile<UserGroupProfile>();
});
IMapper mapper = new Mapper(config);
composition.Register(mapper);
Is there better way to register this? Also I want to register as singleton lifetime how would i do this?
I think I may have found the answer on the LightInject site; you need to register your controller assembly. This did it for me:
public class ControllerStartupComposer : IUserComposer {
public void Compose(Composition composition) {
var serviceContainer = composition.Concrete as LightInject.ServiceContainer;
serviceContainer.RegisterApiControllers(GetType().Assembly);
}
}
Make sure that the controller has a parameterless public constructor
I am in the process of upgrading the package https://our.umbraco.com/packages/backoffice-extensions/redirects-viewer/ to v8.
When creating a property editor I am getting an error with one of the controllers the error is:
The controller inherits from BackOfficeNotificationsController this does not have parameterless constructor only inherited one that must have dependencies injected into it.
The inner states:
In my composer I have:
So I am setting it up, am I missing something?
Regards
Ismail
So got a bit further with this, I updated automapper to latest version then in my composition I now have:
Is there better way to register this? Also I want to register as singleton lifetime how would i do this?
Regards
Ismail
Did you get an answer to this? I'm getting the same message injecting into a custom controller.
I think I may have found the answer on the LightInject site; you need to register your controller assembly. This did it for me:
is working on a reply...