Dear Castle groups, I have a WCF service which has a single constructor dependency - this dependency is 'generically decorated'. i.e. its constructor looks like this: public ServiceGenericDependency(IDecorator<IServiceNoDependencies> arg2)
{ } My 'decorator' constructor looks like this: public Decorator(T arg) { } Castle has the typeof(IDecorator<>) registration, and the typeof(IServiceNoDependencies) registered. PROBLEM: The WCF Facility fails to create the server. IF I add a default constructor to my decorator class, then everything works. IF I resolve the WCF service on the server (as a local component, i.e. take WCFFacility out of the equation) then everything works. I have included a test program below - just reference WcfFacility + Castle. This is quite an urgent issue for me. Thank you! using Castle.Windsor; using Castle.MicroKernel.Registration; using Castle.Facilities.WcfIntegration; using System.ServiceModel; namespace DecoratorChains { class Program { static IWindsorContainer container; static void Main(string[] args) { container = new WindsorContainer() .AddFacility<WcfFacility>(); // this is my decorator, it is capable of decorating any service. container.Register(Component.For(typeof(IDecorator<>)).ImplementedBy(typeof(Decorator<>))); container.Register( Component.For<IServiceGenericDependency>().ImplementedBy<ServiceGenericDependency>().LifeStyle.Transient .AsWcfService(new DefaultServiceModel().AddEndpoints( WcfEndpoint.BoundTo(new NetTcpBinding()) .At("net.tcp://localhost/Operations") ) ) ); // this is my service that WILL BE decorated, then used as a constructor argument. container.Register(Component.For<IServiceNoDependencies>().UsingFactoryMethod(() => new ServiceNoDependencies())); var client = ChannelFactory<IServiceGenericDependency>.CreateChannel( new NetTcpBinding(), new EndpointAddress("net.tcp://localhost/Operations")); // this passes var cc = container.Resolve<IServiceGenericDependency>(); // this fails client.DoSomething(); } } interface IServiceNoDependencies { } class ServiceNoDependencies : IServiceNoDependencies { } interface IDecorator<T> where T : class { } class Decorator<T> : IDecorator<T> where T : class { /// <summary> /// Remove this constructor and all tests will pass /// </summary> /// <param name="arg"></param> public Decorator(T arg) { } } [ServiceContract] interface IServiceGenericDependency { [OperationContract] void DoSomething(); } class ServiceGenericDependency : IServiceGenericDependency { public ServiceGenericDependency(IDecorator<IServiceNoDependencies> arg2) { } public void DoSomething() { } } } -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-users@googlegroups.com. To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.