AI OnAI Off
You need to have a templatedescriptor attribute on your template with Inherited=true
Thanks Johan, I have tried the following and it does not work.
[TemplateDescriptor(Inherited = true)]
public partial class ContactTemplate : SimplePage, IRenderTemplate<Business.Interfaces.IContactRecord>
You need to explicitly register your concrete modeltypes against TemplateModelRepository (this will be changed in CMS 7.5 so the explicit registration is not nessecary) like:
ServiceLocator.Current.GetInstance<TemplateModelRepository>().RegisterModelType(typeof(ActiveDirectoryContactRecord));
This is preferably done in a InitializationModule with module dependency to EPiServer.Web.InitializationModule
I have a website which uses a repository for a contacts search.
I have created a partial router so I can have a virtual contact details page available after my contacts search page which is a page in the CMS.
The 'GetRecord' method in repository returns a type of iContact.
When I register a template for the interface:
I am returned a 404 not found error when navigating to a partially routed page.
When I register a template for a concrete instance of the interface:
The template is returned with the data correctly.
Do I need to register the template differently to work with the interface? Is this a bug in EPiServer? Should it be possible to-do this?
Thanks,
Adam