With the recent changes to Rhino.Security it now requires ISession to be provided by the container, so how should I register ISession when I'm using Rhino.Commons?
On 25 Nov, 10:59, Ayende Rahien <[email protected]> wrote: > IOW, > The problem is that > NHibernateUnitOfWorkFactory.CurrentSession is settable. > > On Wed, Nov 25, 2009 at 12:59 PM, Ayende Rahien <[email protected]> wrote: > > Hm, I don't think this is related to Rhino Security. > > What is happening is that during the resolution of IUoWFactory, you are > > trying to access UnitOfWork. > > That is likely going to cause issues. > > > On Wed, Nov 25, 2009 at 12:50 PM, ChrisR <[email protected]>wrote: > > >> 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]> > >> <rhino-tools-dev%[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]<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.
