开发者

Fluent NHibernate and automapping generic types

开发者 https://www.devze.com 2023-01-13 21:37 出处:网络
I\'m automapping most of my model, but have a problem with generics. I\'ve got ValueContainer<TValue>, and I make it abstract so that it

I'm automapping most of my model, but have a problem with generics. I've got ValueContainer<TValue>, and I make it abstract so that it doesn't throw an exception during automapping. Next, I have to create classes like StringValueContainer just to make it mapped. Needless to say, I don't like this approach, since I'm perfectly happy with the generic classes.

So, the question is, ho开发者_如何转开发w do I manually map classes like ValueContainer<string> that inherit from an automapped class? I tried to fluently configure the subclass via SubclassMap, but that, predictably, failed.

Just to clarify: I've got StringValueContainer: ValueContainer<string>, but the StringValueContainer class doesn't add any value except for automapping, so I'm wondering if it's possible to do it in a cleaner way.

0

精彩评论

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