Thank you very much for the solution provided below, it opened a cuple
of new possibilities. I am however still unable to solve the
registration problem. The reason is that interfaces get skipped during
registration. I guess that is probaly what you've ment with the last
part of your answer... Here what i came up with (comments in code):

//--------------------------------

kernel.Register(AllTypes.
FromAssemblyContaining(typeof(IService))
.Where(
c =>
        {
                var name = c.Name;
                log.Debug(name);

                //only classes are selected - interfaces are skipped

                return c.Namespace == "AppServices";
        }
)
.WithService.FirstInterface()
.Configure(c => c.ActAs(new DefaultServiceModel()
.AddEndpoints(
        WcfEndpoint.BoundTo(wsHttpBinding).At(
        "http://localhost:9999/"; +

        //classes don't have description and they implement may interfaces
        //I probably could loop through all of them, but there has to be some
        //sort of a swith or something to reverse the process - so that
        //interfaces don't get skipped

        ContractDescription.GetContract(c.ServiceType))))));


//--------------------------------

Craig Neuwirt je napisal:
> You could probably add a marker interface like IService and perform a
>
> container.Register(AllTypes.FromAssemblyXXX()
>    .WithService.FromInterface(typeof(IService)
>    .Configure(c => c.ActAs(new DefaultClientModel(
>        WcfEndpoint.BoundTo(wsHttpBinding)
>       .At("http://localhost:9999/"; +
> ContractDescription.GetContract(c.Name))));
>
> Same for server.
>
> This may require a small change to registration to allow just interfaces to
> be included.  I'll have to check
>
>
> On Fri, May 8, 2009 at 5:31 AM, Miha Necak <[email protected]> wrote:
>
> >
> > In my application i have about 50 services that i have to register
> > using Windsor and WCF facility. I did some customizations for security
> > and session per call behavior. I am trying to find an elegant way to
> > setup both the client ant the server configuration without copy/
> > pasting the code (final three blocks at the bottom of each
> > configuration).
> >
> >
> > My current client configuration:
> > //------------------------------------------------------
> > var kernel = new WindsorContainer();
> > IoC.Initialize(kernel);
> >
> > kernel.Register(Component.For<ILogger>().ImplementedBy<CustomLogger>
> > ());
> > kernel.Register(Component.For<IChannelFactoryAware>().
> > ImplementedBy<CustomChannelFactoryAware>());
> > kernel.AddFacility<WcfFacility>();
> >
> > WSHttpBinding wsHttpBinding = new WSHttpBinding(SecurityMode.Message);
> > wsHttpBinding.Security.Message.ClientCredentialType =
> > MessageCredentialType.UserName;
> >
> > kernel.Register(Component.For<IService1>()
> > .ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
> > .At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService1)).Name))));
> >
> > kernel.Register(Component.For<IService2>()
> > .ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
> > .At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService2)).Name))));
> >
> > kernel.Register(Component.For<IService3>()
> > .ActAs(new DefaultClientModel(WcfEndpoint.BoundTo(wsHttpBinding)
> > .At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService3)).Name))));
> > //------------------------------------------------------
> >
> >
> > My current server configuration:
> > //------------------------------------------------------
> > var kernel = new WindsorContainer();
> > IoC.Initialize(kernel);
> >
> > kernel.Register(Component.For<ILogger>().ImplementedBy<ConsoleLogger>
> > ());
> > kernel.Register(Component.For<IServiceHostBuilder<DefaultServiceModel>>
> > ()
> > .ImplementedBy<CustomServiceHostBuilder>());
> >
> > kernel.Register(Component.For<ISessionFactory>()
> > .Instance(ConfigureDatabaseConnection()));
> >
> > kernel.Register(Component.For<IServiceBehavior>
> > ().ImplementedBy<SessionPerCallBehavior>());
> > kernel.AddFacility<WcfFacility>();
> >
> > WSHttpBinding wsHttpBinding = new WSHttpBinding(SecurityMode.Message);
> > wsHttpBinding.Security.Message.ClientCredentialType =
> > MessageCredentialType.UserName;
> >
> > kernel.Register(Component.For<IService1>().ImplementedBy<Service1>()
> > .ActAs(new DefaultServiceModel().AddEndpoints(
> > WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService1)).Name))));
> >
> > kernel.Register(Component.For<IService2>().ImplementedBy<Service2>()
> > .ActAs(new DefaultServiceModel().AddEndpoints(
> > WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService2)).Name))));
> >
> > kernel.Register(Component.For<IService3>().ImplementedBy<Service3>()
> > .ActAs(new DefaultServiceModel().AddEndpoints(
> > WcfEndpoint.BoundTo(wsHttpBinding).At("http://localhost:9999/"; +
> > ContractDescription.GetContract(typeof(IService3)).Name))));
> > //------------------------------------------------------
> >
> >
> > Any pointers are more than welcome.
> >
> > >
> >
--~--~---------~--~----~------------~-------~--~----~
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