public class HomeViewModel
{
public string Title { get; set; }
public string Description { get; set; }
public string MetaTitle { get; set; }
public virtual IEnumerable<CarouselItem> Carousel { get; set; }
}
I have Carouse model
public class CarouselItem
{
public string Image { get; set; }
public string Title { get; set; }
public string Text { get; set; }
}
My mapper configs
HomeMap
public class HomeMap : UmbMapperConfig<HomeViewModel>
{
public HomeMap()
{
this.AddMap(item => item.Title);
this.AddMap(item => item.MetaTitle);
this.AddMap(item => item.Description);
this.AddMap(item => item.Carousel).SetMapper<ArchetypeFactoryPropertyMapper>();
}
}
and CarouselMap
public class CarouselMap : UmbMapperConfig<CarouselItem>
{
public CarouselMap()
{
this.AddMap(item => item.Image).SetMapper<UmbracoPickerPropertyMapper>();
this.AddMap(item => item.Title);
this.AddMap(item => item.Text);
}
}
My Action where I make map
public override ActionResult Index(RenderModel model)
{
var viewModel = model.Content.MapTo(typeof(HomeViewModel));
return CurrentTemplate(viewModel);
}
UmbMapper for Archetype return null elements
I have model Home
I have Carouse model
My mapper configs
HomeMap
and CarouselMap
My Action where I make map
But for Carousel I get null in list
Could you explain me, what I should to do wrong?
Hi Hryhorii
Did you find a solution to this issue? Can you share with our community?
/Oleksandr
It was different versions. We do not using Archetype on our project.
But we are using Document Type + Nested Content
Thanks for sharing the case. Have a great evening!
/Alex
is working on a reply...