views:

114

answers:

1

Hello All, I am quite blocked about an exception.

I am using Active Record and Monorail. I was able to use the scaffold controllers in monorail, until I add new models.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,NHibernate.Mapping.PersistentClass].get_Item (System.String key) [0x00000] 
at NHibernate.Cfg.Configuration+Mapping.GetPersistentClass (System.String className) [0x00000] 
at NHibernate.Cfg.Configuration+Mapping.GetIdentifierType (System.String className) [0x00000] 
at NHibernate.Type.EntityType.GetIdentifierType (IMapping factory) [0x00000] 
at NHibernate.Type.EntityType.GetIdentifierOrUniqueKeyType (IMapping factory) [0x00000] 
at NHibernate.Persister.Entity.AbstractPropertyMapping.InitIdentifierPropertyPaths (System.String path, NHibernate.Type.EntityType etype, System.String[] columns, IMapping factory) [0x00000] 
at NHibernate.Persister.Entity.AbstractPropertyMapping.InitPropertyPaths (System.String path, IType type, System.String[] columns, System.String[] formulaTemplates, IMapping factory) [0x00000] 
at NHibernate.Persister.Entity.AbstractEntityPersister.InitOrdinaryPropertyPaths (IMapping mapping) [0x00000] 
at NHibernate.Persister.Entity.AbstractEntityPersister.InitPropertyPaths (IMapping mapping) [0x00000] 
at NHibernate.Persister.Entity.AbstractEntityPersister.PostConstruct (IMapping mapping) [0x00000] 
at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor (NHibernate.Mapping.PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) [0x00000] 
at NHibernate.Persister.PersisterFactory.CreateClassPersister (NHibernate.Mapping.PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) [0x00000] 
at NHibernate.Impl.SessionFactoryImpl..ctor (NHibernate.Cfg.Configuration cfg, IMapping mapping, NHibernate.Cfg.Settings settings, NHibernate.Event.EventListeners listeners) [0x00000] 
at NHibernate.Cfg.Configuration.BuildSessionFactory () [0x00000] 
at Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory (System.Type type) [0x00000] 
at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateScopeSession (System.Type type) [0x00000] 
at Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession (System.Type type) [0x00000] 
at (wrapper synchronized) Castle.ActiveRecord.Framework.SessionFactoryHolder:CreateSession (System.Type)
at Castle.ActiveRecord.ActiveRecordBase.FindAll (System.Type targetType, NHibernate.Criterion.DetachedCriteria detachedCriteria, NHibernate.Criterion.Order[] orders) [0x00000] 
at Castle.ActiveRecord.ActiveRecordBase.FindAll (System.Type targetType) [0x00000] 
at Inventory.Product.FindAll () [0x00000] in /home/mariocesar/Proyectos/Mangos/Mangos.Apps/Inventory/Product.cs:114 
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 

Here is all the sourcecode: http://bitbucket.org/mariocesar/mangos/src

By Example, for the model Inventory.Product there is the ProductsController, it Work until I add some relations.

http://bitbucket.org/mariocesar/mangos/src/tip/Mangos.Apps/Inventory/Product.cs

I don't understand if the problem is in NHibernate, or if can't be Scaffold, or if the problem is ActivRecord.

A hint, would be nice

A: 

I found the problem, was a Missing Active Record declaration.

http://bitbucket.org/mariocesar/mangos/changeset/6e81c9f81d47

Mario César