开发者

Exception in Automapping and FNH in BuildSessionFactory Line

i am using the latest version of automapping and开发者_Python百科 FNH with vs2008, i got this exception "Tried to add property 'Description' when already added"

first , the exception is not informative! i cannot find out which class cause this error.

secondly, how can i solve this problem ? is it because of an abstract 'description' property i have ?


If it's an abstract property that you don't intend to map to the database you might want to add an Ignore to that property in your automapping override.

 mapping.IgnoreProperty(x => x.Description);


Looking at the FluentNHibernate code that throws this exception suggests that you might be calling Map(x => x.Description) twice in your class map.


I had the same issue but when i checked the Map class i found out for some reason the code generator has put two instance of the same property as a result in run time this exception was thrown.

As a check list please check your Map file of the entity map class and make sure the mapping is unique to property.

I was able run it once i removed the duplicate one.

thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜