سؤال

i am using the latest version of automapping and 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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top