The factory facility is registered. Here is the complete container
initialisation code:
container.AddFacility<StartableFacility>();
container.AddFacility<FactorySupportFacility>();
container.AddFacility("logging.facility", new LoggingFacility
(LoggerImplementation.Log4net, "log4net.config"));
container.Register(
Component.For<INHibernateInitializationAware>()
.ImplementedBy<NHibernateMsSql2005ExpressInitialization>()
.LifeStyle.Singleton);
container.Register(
Component.For(typeof (IRepository<>))
.ImplementedBy(typeof (NHRepository<>))
.LifeStyle.Transient);
container.Register(
Component.For<IUnitOfWorkFactory>()
.ImplementedBy<NHibernateUnitOfWorkFactory>()
.LifeStyle.Singleton);
container.Register(
Component.For<IAuthorizationService>()
.ImplementedBy<AuthorizationService>()
.LifeStyle.Transient);
container.Register(
Component.For<IAuthorizationRepository>()
.ImplementedBy<AuthorizationRepository>()
.LifeStyle.Transient);
container.Register(
Component.For<IPermissionsBuilderService>()
.ImplementedBy<PermissionsBuilderService>()
.LifeStyle.Transient);
container.Register(
Component.For<IPermissionsService>()
.ImplementedBy<PermissionsService>()
.LifeStyle.Transient);
container.Register(
Component.For<ISession>()
.UsingFactoryMethod(() => UnitOfWork.CurrentSession)
.LifeStyle.Transient);
On 25 Nov, 08:40, Ayende Rahien <[email protected]> wrote:
> I think that you need to register the factory facility
>
> On Tue, Nov 24, 2009 at 8:20 PM, ChrisR <[email protected]> wrote:
> > When using the latest version of rhino.commons, how can the ISession
> > interface be provided for use with rhino.security?
>
> > If I attempt to register ISession using a factory method as below:
>
> > container.Register(
> > Component.For<ISession>()
> > .UsingFactoryMethod(() => UnitOfWork.CurrentSession)
> > .LifeStyle.Transient);
>
> > then I get a CircularDependencyException:
>
> > Castle.MicroKernel.Exceptions.CircularDependencyException: A cycle was
> > detected when trying to resolve a dependency. The dependency graph
> > that resulted in a cycle is:
> > - Service dependency 'CurrentSession' type 'NHibernate.ISession' for
> > NHibernate.ISession CurrentSession in type
> > Rhino.Commons.NHibernateUnitOfWorkFactory
> > + Service dependency 'CurrentSession' type 'NHibernate.ISession' for
> > NHibernate.ISession CurrentSession in
> > Rhino.Commons.NHibernateUnitOfWorkFactory
>
> > --
>
> > 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]<rhino-tools-dev%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhino-tools-dev?hl=en.
--
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.