Asp net BoilerPlate CreateMultiLingualMap With ProjectTo

13 Views Asked by At

I am using asp.net boilerplate multilingual mapper but it it does not access the translations when I use AutoMapper Extension Project To it fails to reach translations to get the name so it return null

If I tried Manual Include it works so fine

 var category = await BaseRepository.GetAll()
                                    .Where(x => x.Id == id)
                                    .Include(x=>x.Translations)
                                    .FirstOrDefaultAsync();

 var response = category.MapToType<AdminCategoryDto>();

and returns

{
    "id": 16,
    "name": "Cat1"
 }

but this code

var response = await BaseRepository.GetAll()
                                    .Where(x => x.Id == id)
                                    .ProjectTo<AdminCategoryDto>(ConfigurationProvider)
                                    .FirstOrDefaultAsync();

returns this

 {
     "id": 16,
     "name": null
 }

and this is my mapper

config.CreateMultiLingualMap<Category,long,CategoryTranslation,long, AdminCategoryDto>(MultiLingualMapContext)

0

There are 0 best solutions below