How to make Fluent NHibernate ignore Dictionary properties

Posted by Matt Winckler on Stack Overflow See other posts from Stack Overflow or by Matt Winckler
Published on 2010-05-20T22:21:58Z Indexed on 2010/05/20 22:30 UTC
Read the original article Hit count: 441

I'm trying to make Fluent NHibernate's automapping ignore a Dictionary property on one of my classes, but Fluent is ignoring me instead. Ignoring other types of properties seems to work fine, but even after following the documentation and adding an override for the Dictionary, I still get the following exception when BuildSessionFactory is called:

The type or method has 2 generic parameter(s), but 1 generic argument(s) were provided. A generic argument must be provided for each generic parameter.

I've tried overriding by property name:

.Override<MyClass>(map => {
    map.IgnoreProperty(x => x.MyDictionaryProperty);
})

and also tried implementing ignores using a custom attribute, both of which result in the same exception from BuildSessionFactory. The only thing so far that makes this exception go away is removing the Dictionary property entirely.

My question seems to be identical to this one which was never answered (though I'll expand the scope by stating it doesn't matter whether the dictionary is on an abstract base class; the problem always happens for me regardless of what class the property is on). Any takers this time around?

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about automapping