I probably should have provided this detail up front. I have IRepository<TEntity> which is implemented by LinqRepository<TEntity, TDataContext>. So, for each type T in the assembly that inherits from DataContext I need to do: for each property of T whose type is Table<U>, register a component for IRepository<U> implemented by LinqRepository<U, T>
The fact that I have to type all this out probably means that this is a special enough case not to be covered by the default API. It would be nice to have a general .SelectMany() hanging off the end of the type finding stuff so I could do something like: container.Register( AllTypes.FromThisAssembly() .BasedOn(....) .SelectMany(a single type => a set of Component registrations) ) On Mar 3, 3:20 pm, José F. Romaniello <[email protected]> wrote: > in the end you want to register > > IRepository<T> pointing to Table<T>? > > 2011/3/3 Rob <[email protected]> > > > > > > > > > I'm using Windsor 2.5.3 and I'm trying to use the fluent registration > > API to register a set of components per type found. What I'm trying to > > achieve is roughly: > > for every type > > in this assembly > > that inherits from X > > don't register X, but instead use X to determine a set of components > > to register. > > > The concrete example is that I want to find every DataContext in my > > assembly and rather than registering the DataContext itself, walk its > > properties and for each one that returns a Table<T>, register my own > > IRepository<T> as a component. > > > I have a pretty strong suspicion that I'm just going to have to do > > this myself, but I would love to reuse the assembly walking code that > > Windsor clearly has. > > > -- > > 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. -- 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.
