if you wanted friendly keys for your repositories. you could do
something like this
class RepositoryKeys
{
         public static readonly string SomeRepository =
typeof(NHRepository<Entity>).FullName;
         public static readonly string OtherRepository =
typeof(MYRepository<Entity>).FullName;
}

the container keeps the naming convention. No new facilities are
required. You get your friendly names.
IoC.Resolve<IRepository<Entity>>(RepositoryKeys.OtherRepository)

now you don't need another Facility and you're keys are strongly
typed.

On Sep 25, 9:29 am, Jason Meckley <[EMAIL PROTECTED]> wrote:
> convention over configuration. if you need the repository by key:
> string key = typeof(NHRepository<Entity>).FullName;
> IRepository<Entity> namedRepository =
> IoC.Resolve<IRepository<Entity>>(key);
>
> Mike Nichols wrote:
> > Sorry about that. I'll update it.
> > Using the NH Unit of work facility doesn't let me pass in the key to
> > be used for the IRepository. As a result, when I want to decorate
> > IRepository with another, I don't have a great way to get they key for
> > passing as a dependency into the other repository impl. I know that
> > the default name is typically the implementation's name but I would
> > rather not rely on that or require that kind of knowledge. The patch
> > just lets me pass in the name of the repository I determine.
> > I'll update as appropriate.
>
> > mike
>
> > On Sep 25, 3:07 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > The patch is missing UnitOfWorkFacilities2,
> > > It addition to that, can you explain what is the purpose of the patch? I
> > > don't think that I follow your intention
>
> > > On Fri, Sep 19, 2008 at 9:14 PM, Mike Nichols <[EMAIL PROTECTED]>wrote:
>
> > > > I needed to key my IRepository implementations for easier decoration
> > > > but wanted to use the UnitOfWorkFacilities (both varieties) so I
> > > > implemented being able to pass the repository key into the facility.
>
> > > > The patch is 'NamedUnitOfWorkFacilityRepositoriesWithTests' and
> > > > uploaded to this group list.
>
> > > > Please see tests for usage or let me know what you think.
>
> > > > Thanks
> > > > Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" 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/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to