You will need to implement a View Rendering that has a model that inherits from Sitecore.Mvc.Presentation.IRenderingModel
. And also implements the Initialize override.
In the initialize you can fetch your custom datasource. See this post for more detail.
Create a new Rendering Model inheriting IRenderingModel.
public class CarouselRenderingModel : Sitecore.Mvc.Presentation.RenderingModel
{
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
CarouselSlides =
Sitecore.Data.ID.ParseArray(Item["SelectedItems"])
.Select(id => Item.Database.GetItem(id)).ToList();
}
public IList CarouselSlides { get; private set; }
}
Add this model to Sitecore models
You will find these in the content tree at /sitecore/layout/Models.
Add the model to the rendering model field.
This is the model field on the View Rendering item itself.