Automap IList<T> as list (instead of bag) as a convention
Hi there,
I have a criteria where it would be a great help, if IList was mapped as list instead of bag.
Is it possible to define a convention for this?
public class ListConvention : IHasManyConvention, IHasManyConventionAcceptance
{
public void Apply(IOneToManyCollectionInstance instance)
{
// use list instead of bag
}
public void Accept(IAcceptanceCriteria<IOneToManyCollectionInspector> criteria)
{
// my criteria
}
}
With ClassMap its possible to say "AsList()", but I cant locate something equal with the automapper.
Support Staff 2 Posted by Paul Batum on 29 Aug, 2010 12:47 AM
This is a known limitation unfortunately. Until we change how the different
collection types are implemented, you won't be able to do this.
On Sat, Aug 28, 2010 at 10:08 PM, Jacob Madsen <
tender+d4afd2f15ee4650cbeeb13d614903479e516debff@tenderapp.com<tender%2Bd4afd2f15ee4650cbeeb13d614903479e516debff@tenderapp.com>
> wrote:
3 Posted by Jacob Madsen on 30 Aug, 2010 09:12 AM
Is it possible to do in some ugly way on the current exposed interfaces? The criteria is not important.
Support Staff 4 Posted by James Gregory on 30 Aug, 2010 09:37 AM
IAutomappingOverridr<T> will allow you to do it on a per-entity basis, but it won't be nice.
This is quite a high priority change for the next release.
5 Posted by Jacob Madsen on 30 Aug, 2010 10:08 AM
I am always looking forward to new releases of cool projects like FNH :-)
I can override automap of a base type and implement my criteria with some reflection magic and then call the AsList() when needed. Would you agree that this could be a (very ugly) possible solution for now?
Support Staff 6 Posted by James Gregory on 30 Aug, 2010 11:31 AM
In theory, that sounds like it'd work :)
I've just started work on fixing this issue, but it may take a little while
as it does require some significant restructuring internally.
On Mon, Aug 30, 2010 at 11:11 AM, Jacob Madsen <
tender+d4afd2f15ee4650cbeeb13d614903479e516debff@tenderapp.com<tender%2Bd4afd2f15ee4650cbeeb13d614903479e516debff@tenderapp.com>
> wrote: