单轨列车例外,“字典中没有给定的密钥。”

时间:2010-06-02 20:30:47

标签: nhibernate mono castle-activerecord castle-monorail

我对一个例外非常封锁。

我正在使用Active Record和Monorail。我能够在单轨列车中使用脚手架控制器,直到我添加新模型。

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] 

以下是所有源代码:http://bitbucket.org/mariocesar/mangos/src

通过示例,对于模型Inventory.Product,有ProductsController,它一直工作,直到我添加一些关系。

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

我不明白问题是在NHibernate中,还是不能是Scaffold,或者问题是ActivRecord。

提示,会很好

1 个答案:

答案 0 :(得分:0)

我发现了问题,是一个失踪的活动记录声明。

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