I have installed my plugin as a nuget package and it seems to be ok. When I go the url my controller serves, ala : /pugpig
I get the following error, which seems to suggest my implementations are not being wierd up.
None of the constructors found with 'Public binding flags' on type 'Umbraco.Pugpig.Web.Controllers.PugpigController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Umbraco.Pugpig.Core.Interfaces.IPugpigRepository pugpigRepository' of constructor 'Void .ctor(Umbraco.Pugpig.Core.Interfaces.IPugpigRepository, Umbraco.Pugpig.Web.Controllers.IAbstractRequest)'.
Can anyone thing what I would be doing wrong? My code is below.
My controller is below:
[DemandsDependencies(typeof(PugpigBuilder))]
public class PugpigController : SurfaceController
{
I got this to work eventually. I didn't need to call containerBuilder.Build(); in my builder and I also created a paramerterless constructor in my controller.
DemandBuilder problems in umbraco 5
I am having serious issue trying to get my dependencies injected into my controller for a pluing I created.
I used the demand builder as suggested here: http://shazwazza.com/post/Registering-custom-components-in-IoC-for-Umbraco-5-plugins.aspx
I have installed my plugin as a nuget package and it seems to be ok. When I go the url my controller serves, ala : /pugpig
I get the following error, which seems to suggest my implementations are not being wierd up.
None of the constructors found with 'Public binding flags' on type 'Umbraco.Pugpig.Web.Controllers.PugpigController' can be invoked with the available services and parameters: Cannot resolve parameter 'Umbraco.Pugpig.Core.Interfaces.IPugpigRepository pugpigRepository' of constructor 'Void .ctor(Umbraco.Pugpig.Core.Interfaces.IPugpigRepository, Umbraco.Pugpig.Web.Controllers.IAbstractRequest)'.
Can anyone thing what I would be doing wrong? My code is below.
My controller is below:
[DemandsDependencies(typeof(PugpigBuilder))]
public class PugpigController : SurfaceController {
private IXmlFormatter m_xmlFormatter;
private readonly IPugpigRepository m_pugpigRepository;
private readonly IAbstractRequest m_abstractRequest;
public PugpigController(IPugpigRepository pugpigRepository, IAbstractRequest abstractRequest) { m_pugpigRepository = pugpigRepository; m_abstractRequest = abstractRequest;
}
}
My Demand builder is this:
public class PugpigBuilder : IDependencyDemandBuilder {
public void Build(IContainerBuilder containerBuilder, IBuilderContext context) { containerBuilder.For(typeof(PugpigRepository)).KnownAs(); containerBuilder.For(typeof(AbstractRequest)).KnownAs(); containerBuilder.Build();
}
}
I got this to work eventually. I didn't need to call containerBuilder.Build(); in my builder and I also created a paramerterless constructor in my controller.
is working on a reply...