I'm registering my services, repositories, etc like this:

http://blog.viabrains.com/2008/10/register-services-in-windsor.html

Couldn't find this feature in microkernel so I implemented it and the patch
is attached. Is this something useful?

Now I can write:

//register all services
container.Register(
    AllTypes.FromAssembly(typeof (ProductService).Assembly)
        .BasedOn<IService>()
        .WithService.FromInterface(typeof (IService)));

//register all repositories
container.Register(
    AllTypes.FromAssembly(typeof(ProductRepository).Assembly)
        .BasedOn<IRepository>()
        .WithService.FromInterface(typeof(IRepository)));

This will be the same as

// Register all services
container.Register(
    Component
        .For<IProductService>()
        .ImplementedBy<ProductService>());

container.Register(
    Component
        .For<IOrderService>()
        .ImplementedBy<OrderService>());

// and so on...

If this patch is approved then Castle.MicroKernel-vs2005.csproj needs to be
modified as well, I think?

Thoughts? I'm not that happy with the name FromInterface() thou

Cheers,
Martin

public class ProductService : IProductService
{
}

public interface IProductService : IService
{
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: Register_from_base_interface.patch
Description: Binary data

Reply via email to