Ensure manually and automatically registered templates shares the same behavior
Aug 05, 2016
Jan 07, 2022
The behavior of the default implementation of ITemplateRepository.AddTemplates should match that of automatically registered templates.
- 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.