2

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 ?

Tiva
  • 33
  • 5

3 Answers3

1

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

Handcraftsman
  • 6,863
  • 2
  • 40
  • 33
1

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);
Variant
  • 17,279
  • 4
  • 40
  • 65
  • yes , that was an abstract property and i marked it with a non persistent attribute to ignore it. thanks – Tiva Nov 25 '10 at 22:29
1

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

Desmond
  • 1,308
  • 1
  • 19
  • 27