Hi Morcs
I am sure you have already checked but are you sure your
IRepositoryFactory and IDynamicActionProviders are registered on the
container?


On Jan 14, 4:40 am, morcs <[email protected]> wrote:
> Hi there,
>
> I'm using the Castle trunk, and I understand that thanks to Mike
> Nichols and his WindsorDynamicActionProviderFactory:
>
> http://groups.google.com/group/castle-project-devel/browse_thread/thr...
>
> I should be able to get Windsor to instantiate my
> DynamicActionProvider with my repository factory.
>
> I have the following code:
>
> [DynamicActionProvider(typeof(CrudActionProvider))]
> public class MyController : Controller
> {
>
> }
>
> public class CrudActionProvider : IDynamicActionProvider
> {
>     private IRepositoryFactory repositoryFactory;
>
>     public CrudActionProvider(IRepositoryFactory repositoryFactory)
>     {
>         this.repositoryFactory = repositoryFactory;
>     }
>
>     public void IncludeActions(IEngineContext engineContext,
> IController controller, IControllerContext controllerContext)
>     {
>         ((Controller)controller).DynamicActions["List"] = new
> ListAction(repositoryFactory);
>     }
>
> }
>
> Unfortunately when I hit the action I get:
>
> No parameterless constructor defined for this object.
>
> I can see the Windsor class in the stack trace though:
>
> [MissingMethodException: No parameterless constructor defined for this
> object.]
>    System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
> publicOnly, Boolean noCheck, Boolean& canBeCached,
> RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
>    System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
> fillCache) +86
>    System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
> skipVisibilityChecks, Boolean fillCache) +230
>    System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
>    System.Activator.CreateInstance(Type type) +6
>
> Castle.MonoRail.Framework.Services.DefaultDynamicActionProviderFactory.Create
> (Type dynamicActionProviderType) +316
>
> Castle.MonoRail.WindsorExtension.WindsorDynamicActionProviderFactory.Create
> (Type dynamicActionProviderType) +149
>    Castle.MonoRail.Framework.Controller.ProcessDynamicActionProviders
> () +184
>    Castle.MonoRail.Framework.Controller.PrepareToExecuteAction
> (IEngineContext engineContext, IControllerContext context) +140
>    Castle.MonoRail.Framework.Controller.Process(IEngineContext
> engineContext, IControllerContext context) +53
>    Castle.MonoRail.Framework.BaseHttpHandler.Process(HttpContext
> context) +175
>
> Many thanks for any help you can give,
>
> morcs
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to