Thanks for your answer - I tried that as well, but that doesn't work either.

Regards

Mark Seemann

- Sent from my mobile device; hence the brevity.

________________________________
Fra: Craig Neuwirt <[email protected]>
Sendt: 26. august 2009 17:25
Til: [email protected] 
<[email protected]>
Emne: Re: Auto-register all types that ends with a given string to their base 
class

You probably need a custom selector like this

container.Register(AllTypes
   .FromAssemblyContaining<
SqlPlugInRepository>()
   .Where(t => t.Name.EndsWith("Repository"))
   .WithService.Select((t, b) => return new Type[] { t.BaseType })
      )


On Wed, Aug 26, 2009 at 10:03 AM, Mark Seemann 
<[email protected]<mailto:[email protected]>> wrote:

Hi all

I'm trying to auto-register all types in an assembly whose name ends
with "Repository". I expect all of these to derive from an abstract
base class that also ends with "Repository", and I'd like to register
them all.

As an example, I would like

public class SqlPlugInRepository : PlugInRepository { ... }

to be registered so that when I Resolve PlugInRepository, I get an
instance of SqlPlugInRepository.

I have tried this, but it doesn't work:

container.Register(AllTypes
   .FromAssemblyContaining<SqlPlugInRepository>()
   .Where(t => t.Name.EndsWith("Repository"))
   .WithService
   .Base());

Note that there is no common Repository supertype that all
Repositories derive from.

The abstract Repositories are defined in a different assembly than
their implmentations.

What am I doing wrong, and what should I be doing instead?

Thank you






--~--~---------~--~----~------------~-------~--~----~
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