Download the source code: http://github.com/lorenzomelato/rhino-commons
Make Modifications.
Compile

You can get more details on the attribute that you will have to modify
from here:
http://groups.google.co.uk/group/rhino-tools-dev/browse_thread/thread/adfec58869ac6b52/451135b51b9b6fbb?lnk=gst&q=unitofwork#451135b51b9b6fbb

-Humberto
On Mar 31, 1:41 pm, Patricia Vandermeer
<[email protected]> wrote:
> Hi Humberto!
> Thanks for the help.   Can you elaborate more on what you mean by:
>
> > You will have to modify the Rhino.Commons source code to share the
> > unitofwork.cerrentsession.
>
> I think my facility and resolver  are pretty much the same as the one you've
> got (except in vb :) )
>
> and i'm getting the error "You are not in a unit of work"
> in the NHibernateUnitOfWorkFactory.cs  here:
>
> public ISession CurrentSession
>         {
>             get
>             {
>                 ISession session =
> (ISession)Local.Data[CurrentNHibernateSessionKey];
>                 if (session == null)
>                   *  throw new InvalidOperationException("You are not in a
> unit of work");*
>                 return session;
>             }
>             set { Local.Data[CurrentNHibernateSessionKey] = value; }
>         }
>
> i'm guessing this has to do with the sharing... i don't know
>
> It would be AMAZING if someone who has a working solution could post the
> barest of barebones working console app w/ the newest versions of
> everything.
>
> Thanks again!
>
> On Wed, Mar 17, 2010 at 4:09 PM, Patricia Vandermeer <
>
>
>
> [email protected]> wrote:
> > Thanks Humberto!  I will try to fix mine when i get back from my vacation
> > :)
>
> > On Wed, Mar 17, 2010 at 3:51 PM, Humberto Franco <[email protected]
> > > wrote:
>
> >> You will have to modify the Rhino.Commons source code to share the
> >> unitofwork.cerrentsession.  I will try to post a documentation article on
> >> ayendes site sometime in the future. In the mean time here is what I have
> >> for my facility and resolver:
> >> public class RhinoSecurityFacility : AbstractFacility
> >>     {
> >>         protected override void Init()
> >>         {
>
> >>             Kernel.Register(
> >>             Component.For<IAuthorizationService>()
> >>             .ImplementedBy<AuthorizationService>()
> >>             .LifeStyle.Transient,
> >>             Component.For<IAuthorizationRepository>()
> >>             .ImplementedBy<AuthorizationRepository>()
> >>             .LifeStyle.Transient,
> >>             Component.For<IPermissionsBuilderService>()
> >>             .ImplementedBy<PermissionsBuilderService>()
> >>             .LifeStyle.Transient,
> >>             Component.For<IPermissionsService>()
> >>             .ImplementedBy<PermissionsService>()
> >>             .LifeStyle.Transient
> >>             );
>
> >>             Kernel.Resolver.AddSubResolver(new
> >> ServiceIsessionResolver(Kernel));
>
> >>             ServiceLocator.SetLocatorProvider(() => new
> >> WindsorServiceLocator(IoC.Container));
> >>         }
> >>     }
>
> >> public class ServiceIsessionResolver : ISubDependencyResolver
> >>     {
> >>         private IKernel Kernel { get; set; }
>
> >>         public ServiceIsessionResolver(IKernel kernel)
> >>         {
> >>             Kernel = kernel;
> >>         }
>
> >>         public object Resolve(CreationContext context,
> >> ISubDependencyResolver contextHandlerResolver, ComponentModel model,
> >> DependencyModel dependency)
> >>         {
> >>             return Kernel.Resolve<IUnitOfWorkFactory>().CurrentSession;
> >>         }
>
> >>         public bool CanResolve(CreationContext context,
> >> ISubDependencyResolver contextHandlerResolver, ComponentModel model,
> >> DependencyModel dependency)
> >>         {
> >>             return
> >> typeof(ISession).IsAssignableFrom(dependency.TargetType);
> >>         }
> >>     }
>
> >> On Wed, Mar 17, 2010 at 12:09 PM, patricia <[email protected]
> >> > wrote:
>
> >>> Hey Beto, Everyone
>
> >>> I've made a facility, and set everything up like the thread you posted
> >>> said to. But i'm not sure where i need to put the [DoNotWire]
> >>> attribute!    I'm getting this error:
> >>> {"A cycle was detected when trying to resolve a dependency. The
> >>> dependency graph that resulted in a cycle is:  - Service dependency
> >>> 'session' type 'NHibernate.ISession' for
> >>> Void .ctor(NHibernate.ISession) in type
> >>> Rhino.Security.Services.AuthorizationRepository  - Parameter
> >>> dependency 'configurationFileName' type 'System.String' for
> >>> Void .ctor(System.Reflection.Assembly[], System.String) in type
> >>> Rhino.Commons.NHibernateUnitOfWorkFactory  + Parameter dependency
> >>> 'configurationFileName' type 'System.String' for
> >>> Void .ctor(System.Reflection.Assembly[], System.String) in
> >>> Rhino.Commons.NHibernateUnitOfWorkFactory "}
>
> >>> this is my facility and  sub resolver
>
> >>> Public Class RhinoSecurityFacility
> >>>    Inherits AbstractFacility
>
> >>>    Protected Overloads Overrides Sub Init()
> >>>        Kernel.Resolver.AddSubResolver(New
> >>> ServiceISessionResolver(Kernel))
>
> >>>        Kernel.Register( _
> >>>            Component.For(Of INHibernateInitializationAware)() _
> >>>                .ImplementedBy(Of NHibernateDbSchemaGeneration)())
>
> >>>        Kernel.Register( _
> >>>            Component.For(Of IEntityInformationExtractor(Of Org))() _
> >>>                .ImplementedBy(Of
> >>> VBRhinoSample.OrgInformationExtractor)() _
> >>>        )
> >>>        Kernel.Register( _
> >>>            Component.For(Of IEntityInformationExtractor(Of User))() _
> >>>                .ImplementedBy(Of
> >>> VBRhinoSample.UserInformationExtractor)() _
> >>>        )
> >>>        Kernel.Register( _
> >>>            Component.For(Of IEntityInformationExtractor(Of
> >>> CustomField))() _
> >>>                .ImplementedBy(Of
> >>> VBRhinoSample.CustomFieldInformationExtractor)() _
> >>>        )
> >>>        Kernel.Register( _
> >>>            Component.For(Of IEntityInformationExtractor(Of
> >>> Qualification))() _
> >>>            .ImplementedBy(Of
> >>> VBRhinoSample.QualificationFieldInformationExtractor)() _
> >>>        )
>
> >>>        Kernel.Register( _
> >>>             Component.For(Of IPermissionsService) _
> >>>             .ImplementedBy(Of
>
> >>> Rhino.Security.Services.PermissionsService).LifeStyle.Is(Castle.Core.Lifest
> >>>  yleType.Transient)
> >>> _
> >>>         )
> >>>        Kernel.Register( _
> >>>            Component.For(Of IPermissionsBuilderService) _
> >>>            .ImplementedBy(Of
>
> >>> Rhino.Security.Services.PermissionsBuilderService).LifeStyle.Is(Castle.Core
> >>>  .LifestyleType.Transient)
> >>> _
> >>>        )
>
> >>>        Kernel.Register( _
> >>>            Component.For(Of IAuthorizationRepository) _
> >>>            .ImplementedBy(Of
>
> >>> Rhino.Security.Services.AuthorizationRepository).LifeStyle.Is(Castle.Core.L
> >>>  ifestyleType.Transient)
> >>> _
> >>>        )
> >>>        Kernel.Register( _
> >>>            Component.For(Of IAuthorizationService) _
> >>>            .ImplementedBy(Of
>
> >>> Rhino.Security.Services.AuthorizationService).LifeStyle.Is(Castle.Core.Life
> >>>  styleType.Transient)
> >>> _
> >>>        )
>
> >>>        Kernel.Resolver.AddSubResolver(New
> >>> ServiceISessionResolver(Kernel))
>
> >>>    End Sub
> >>> End Class
>
> >>> Public Class ServiceISessionResolver
> >>>    Implements Castle.MicroKernel.ISubDependencyResolver
>
> >>>    Dim m_kernel As Castle.MicroKernel.IKernel
>
> >>>    Public Sub New(ByVal kernel As Castle.MicroKernel.IKernel)
> >>>        m_kernel = kernel
>
> >>>    End Sub
>
> >>>    Public Function Resolve(ByVal context As CreationContext, ByVal
> >>> contexthandlerResolver As ISubDependencyResolver, ByVal model As
> >>> Castle.Core.ComponentModel, ByVal dependency As DependencyModel) As
> >>> Object Implements Castle.MicroKernel.ISubDependencyResolver.Resolve
> >>>        Return m_kernel.Resolve(Of IUnitOfWorkFactory).CurrentSession
>
> >>>    End Function
>
> >>>    Public Function CanResolve(ByVal context As
> >>> Castle.MicroKernel.CreationContext, ByVal contextHandlerResolver As
> >>> Castle.MicroKernel.ISubDependencyResolver, ByVal model As
> >>> Castle.Core.ComponentModel, ByVal dependency As
> >>> Castle.Core.DependencyModel) As Boolean Implements
> >>> Castle.MicroKernel.ISubDependencyResolver.CanResolve
> >>>        Return True
>
> >>>    End Function
>
> >>> End Class
>
> >>> I THINK I'm close to finally getting this working!
>
> >>> i tried putting the DoNotWire on the currentsession property in the
> >>> UnitOfWork.cs   and on the CurrentSession property in the
> >>> nhibernateUnitOfWorkFactory.cs
>
> >>> Help Please!  and thank you :)
>
> >>> On 16 Mar, 15:17, Patricia Vandermeer <[email protected]>
> >>> wrote:
> >>> > Thanks Beto!
> >>> > that explains a few things!
>
> >>> > On Tue, Mar 16, 2010 at 2:50 PM, Beto <[email protected]>
> >>> wrote:
> >>> > > Patricia,
>
> >>> > > You will need to create your own facility and resolver, look at this:
>
> >>>http://groups.google.co.uk/group/rhino-tools-dev/browse_thread/thread...
>
> >>> > > On 16 Mar, 09:41, Patricia Vandermeer <[email protected]
>
> >>> > > wrote:
> >>> > > > I found this thread:
>
> >>>http://groups.google.co.uk/group/rhino-tools-dev/browse_thread/thread...
>
> >>> > > > which explains where it went.  But i'm having the same problem that
> >>> Dan
> >>> > > was
> >>> > > > having!
>
> >>> > > > Can't create component
> >>> 'Rhino.Security.Services.AuthorizationRepository'
> >>> > > as
>
> >>> > > > > it has dependencies to be satisfied.
> >>> > > > > Rhino.Security.Services.AuthorizationRepository is waiting for
> >>> the
> >>> > > > > following dependencies:
>
> >>> > > > > Services:
> >>> > > > > - NHibernate.ISession which was not registered.
>
> >>> > > > Thanks again for the help!
>
> >>> > > > On Tue, Mar 16, 2010 at 12:11 PM, patricia <
> >>> > > [email protected]>wrote:
>
> >>> > > > > Hello, Me again,
>
> >>> > > > > I'm trying to build my project with fresh versions of rhino
> >>> commons
> >>> > > > > and security and castle windsor.  But i seem to have lost
> >>> > > > > RhinoSecurityFacility !
>
> >>> > > > > in the RhinoSecNhSetup.zip   sample app it seems to be in
> >>> > > > > rhino.security  but it is no where to be found in the version i
> >>> got
> >>> > > > > from github!
>
> >>> > > > > here is what visual studio's comes up with when i do a "go to
> >>> > > > > definition"  on it in the sample project:
>
> >>> > > > > using Castle.MicroKernel.Facilities;
> >>> > > > > using System;
>
> ...
>
> read more »

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