views:

282

answers:

0

I want to map some of my domain objects back to ORM (LLBLGen) entities, for this I'm using AutoMapper. The domain objects contain collections, and the AutoMapper documentation states that we don't have to worry about them, just about the types they contain. This isn't always the case...

When trying to map to the collections I'm getting a LLBLGen error stating it's not allowed to Clear the ListSource, and we should use the associated collection. So what happens is that AutoMapper seems to be using the LLBLGen collection as a ListSource type, in which LLBLGen has overridden the Clear method(not allowing usage).

Creating a resolver doesn't solve this problem, as the destination collection is read-only, so completely replacing it doesn't work.

What I need is a way to customize the way AutoMapper maps collections. This is on the collection level, not type level.