I\'ve got some problems using EF with AutoMapper. =/
for example :
I\'ve got 2 related entities ( Customers and Orders ) and they\'re DTO classes :
I'm not sure what your problem is, but - when i wanted to use LINQToEntities (switched to NHibernate),
i managed to use automapper with success.
Take a look at code:
public class SimpleMapper
{
public static TTo Map(TFrom fromModel)
{
Mapper.CreateMap();
return Mapper.Map(fromModel);
}
public static IList MapList(IList fromModel)
{
Mapper.CreateMap();
return Mapper.Map, IList>(fromModel);
}
}
public class RepositoryBase
{
public IList Map(IList model)
{
return SimpleMapper.MapList(model);
}
public TModel Map(TLINQModel model)
{
return SimpleMapper.Map(model);
}
public TLINQModel Map(TModel model)
{
return SimpleMapper.Map(model);
}
public IList Map(IList model)
{
return SimpleMapper.MapList(model);
}
public IList Map(IList model)
{
return SimpleMapper.MapList(model);
}
}
It's quite cryptic, always recreates mappings, but it worked. I hope it helps somehow. :)