nHibernate one-to-many mapping question
I am getting this exception when mapping one-to-many relation. my mapping xml looks like this:
<set name="-----" generic="true" inverse="true" cascade="a开发者_开发技巧ll" lazy="false">
<key column="Id" />
<one-to-many class="-----------,---------" />
</set>
And,
<many-to-one name="------" column="Id" not-null="true" class="---------,-------" />
and the Exception:
------ Test started: Assembly: ----------.dll ------
TestCase '-------.GetSchema' failed: NHibernate.MappingException : Could not determine type for: Iesi.Collections.Generic.ISet`1[[-----------, --------, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, for columns: NHibernate.Mapping.Column(--------)
at NHibernate.Mapping.SimpleValue.get_Type()
at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
at NHibernate.Mapping.Property.IsValid(IMapping mapping)
at NHibernate.Mapping.PersistentClass.Validate(IMapping mapping)
at NHibernate.Mapping.RootClass.Validate(IMapping mapping)
at NHibernate.Cfg.Configuration.Validate()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at in
0 passed, 1 failed, 0 skipped, took 4.20 seconds (NUnit 2.5.2).
Please tell me whats going on here. Thanks, Reddy
Edit: Sorry folks, It's a typo, i found it after posting my question... weird....
In my case it was not a typo, I had a class RuleInfo
that had a field of type ActionInfo
.
I managed to solve my problem by adding [Serializable]
to ActionInfo
class.
The funny thing is that everything worked fine while using ActionInfo
, i.e. I could use my unit tests to CRUD it on the DB.
I could also CRUD RuleInfo
class without the ActionInfo
field. After adding the field the error appeared.
精彩评论