Thanks for the reply. I solved it by adding the mapping element to nhibernate.config for Rhino.Security instead of setting it in fluent nhibernate. <mapping assembly="Rhino.Security" /> I will create a test case later when I'm home.
On Jun 22, 4:59 am, Ayende Rahien <[email protected]> wrote: > Hi, > Please create a test case for this. > > On Sat, Jun 20, 2009 at 9:06 PM, Tomas E <[email protected]> wrote: > > > Hello, > > > I'm trying to integrate Rhino.Security in my web application which is > > using NHibernate from trunk and fluent nhibermate. On startup I get > > this exception. > > > --------------------------- Exception ---------------------------- > > System.NullReferenceException occurred > > Message="Object reference not set to an instance of an object." > > Source="Rhino.Security" > > StackTrace: > > at > > Rhino.Security.Impl.MappingRewriting.UserMapper.HandleManyToManySet > > (Property property, PersistentClass classMapping) in ...\rhino-tools > > \security\Rhino.Security\Impl\MappingRewriting\UserMapper.cs:line 94 > > InnerException: > > ----------------------------------------------------------------------- > > > On the line 94 where the exception is thrown, were it updates the > > reference for UsersGroup.Users to my User entity. But the > > collection.Element is null and the nullref exception is thrown. > > > UpdateForeignKeyReferences(classMapping, collection.Element.Table); > > > Thanks a lot in advance! > > Best regards Tomas. > > > Here is all my configuration files, > > ----------------------- Global.asax.cs ------------------------- > > > Container.Kernel.AddFacility("nh", new > > NHibernateUnitOfWorkFacility()); > > Container.Kernel.AddFacility<RhinoTransactionFacility> > > ("rhino_transaction"); > > Container.Kernel.AddFacility("rhino_security", new > > RhinoSecurityFacility(SecurityTableStructure.Prefix,typeof (User))); > > > Container.AddComponent<INHibernateInitializationAware, > > FluentNHibernateInitializationAwareConfigurator>(); > > ------------------------------------------------------------------------- > > > ----------------------- > > FluentNHibernateInitializationAwareConfigurator.cs > > -------------------- > > > public class FluentNHibernateInitializationAwareConfigurator : > > INHibernateInitializationAware > > { > > public void BeforeInitialization() { } > > > public void Configured(Configuration cfg) > > { > > Fluently.Configure().Mappings(m => > > { > > > m.AutoMappings.Add > > (AutoPersistenceModel.MapEntitiesFromAssemblyOf > > > <User>() > > > .Where > > ( > > > t => > > > t.Namespace == > > > "Model.Entities" && t.BaseType != null && t.IsSubclassOf(typeof > > (Entity))) > > > .WithSetup > > (c => c.IsBaseType = > > > type => type == typeof(Entity)).ConventionDiscovery.Add > > (ConventionBuilder.Id.Always(x => x.GeneratedBy.HiLo(100.ToString())), > > ConventionBuilder.Id.Always(x => > > x.Access.AsReadOnlyPropertyThroughLowerCaseField())) > > > ); > > > //m.Apply(cfg); > > > m.HbmMappings.AddFromAssemblyOf<UsersGroup>(); > > m.Apply(cfg); > > }); > > new SchemaExport(cfg) > > .Create(false, true); > > //.ExposeConfiguration(BuildSchema); > > } > > > public void Initialized(Configuration cfg, ISessionFactory > > sessionFactory) { } > > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
