Hi,
I'm using S#arp Architecture 1.6 and have implemented the Rhino Security integration as per
Rhino Security - S#arp Architecture
I'm using the latest build from Rhino.Commons
My Application_EndRequest method contains
ISession session = NHibernateSession.Current;
My ComponentRegister.cs contains
container.Kernel.Register(
Component.For<IAuthorizationService>()
.ImplementedBy<AuthorizationService>()
.LifeStyle.Is(LifestyleType.Transient),
Component.For<IAuthorizationRepository>()
.ImplementedBy<AuthorizationRepository>()
.LifeStyle.Is(LifestyleType.Transient),
Component.For<IPermissionsBuilderService>()
.ImplementedBy<PermissionsBuilderService>()
.LifeStyle.Is(LifestyleType.Transient),
Component.For<IPermissionsService>()
.ImplementedBy<PermissionsService>()
.LifeStyle.Is(LifestyleType.Transient),
Component.For<IUnitOfWorkFactory>()
.ImplementedBy<NHibernateUnitOfWorkFactory>()
.LifeStyle.Is(LifestyleType.Singleton),
Component.For<Rhino.Commons.IRepository<User>>()
.ImplementedBy<NHRepository<User>>()
.LifeStyle.Is(LifestyleType.Transient)
);
container.AddFacility<FactorySupportFacility>()
.Register(Component.For<ISession>()
.UsingFactoryMethod(() => NHibernateSession.Current)
.LifeStyle.Is(LifestyleType.Transient));
I have also added RhinoSecurityPersistenceConfigurer() as per instructions.
The error I'm recieving on calling
UnitOfWork.Start()
is
An association from the table Permissions refers to an unmapped class: Rhino.Security.IUser
Does anyone know what the cause of this error may be?
Has anyone successfully integrated Rhino.Security with S#arp Architecture?
Any help would be great.
Thanks
Rich
-- Additional Details --
Thanks for all the replies so far.
I've still not been able to resolve this, so thought I'd add more details.
In my Global.asax.cs I have
private void InitializeNHibernateSession()
{
NHibernateSession.Init(
webSessionStorage,
new string[] { Server.MapPath("~/bin/SwitchSnapshot.Data.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"),
null, null, new RhinoSecurityPersistenceConfigurer());
}
RhinoSecurityPersistenceConfigurer :
public Configuration ConfigureProperties(Configuration nhibernateConfig)
{
Security.Configure<User>(nhibernateConfig, SecurityTableStructure.Prefix);
return nhibernateConfig;
}
I have an AuthorizationAttribute which calls
using (UnitOfWork.Start())
The error is occuring in NHibernateUnitOfWorkFactory.cs as
sessionFactory = cfg.BuildSessionFactory();