Ensure manually and automatically registered templates shares the same behavior

Fixed in

EPiServer.CMS.Core 11.1.0

Created

Aug 05, 2016

Updated

Oct 01, 2020

Area

CMS Core

State

Closed, Fixed


Description

The behavior of the default implementation of ITemplateRepository.AddTemplates should match that of automatically registered templates.

Breaking Changes

  • Templates that are registered manually using ITemplateRepository.AddTemplates will now always be associated with the model type they are added for, rather than the model type indicated through any IRenderTemplate interface of the template. This may affect the template selection during runtime, as the model type association determines which template to use when rendering a content item. This change does not affect automatically registered templates, as they are already registered using the type specified by the IRenderTemplate interface.
  • The default implementation of ITemplateRepository.AddTemplates now checks if an existing template exists before adding one. If the template is already registered, it will not add another one.
  • The default implementation of ITemplateRepository.AddTemplates now makes sure that all template models are read-only before adding them to the repository.