London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Message which shows on error looks like this:
"Unable to load /EPiServer/shell/Stores/metadata/EPiServer.Core.ContentData?modelAccessor=%7B%22contentLink%22%3A%22107356_565607%22%7D&dojo.preventCache=1496137912462 status: 500"
Hello,
I'm wondering if its possible to add "virtual" property to model with its metadata.
Idea of it was to have a property inside Editor page where I can type some value which will be stored outside the tblBigTable (it can be even an external API).
I found that metadata for model can be created by IMetadataProvider.
using TestProject.Models.Pages; using EPiServer.Core; using EPiServer.Shell.ObjectEditing; using System; using System.Collections.Generic; using System.Linq; namespace TestProject.Metadata { public class CustomMetadataProvider : IMetadataProvider { private IMetadataProvider _metadataProvider; public CustomMetadataProvider(IMetadataProvider metadataProvider) { _metadataProvider = metadataProvider; } public ExtendedMetadata CreateMetadata(IEnumerable attributes, Type containerType, Func
and initalizable module to register it:
using TestProject.Models.Pages; using EPiServer.Cms.Shell; using EPiServer.Core; using EPiServer.DataAbstraction.RuntimeModel; using EPiServer.Framework; using EPiServer.Framework.Initialization; using EPiServer.ServiceLocation; using EPiServer.Shell.ObjectEditing; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web.ModelBinding; namespace TestProject.Metadata { [InitializableModule] [ModuleDependency(typeof(InitializableModule))] public class MetadataInitializableModule : IInitializableModule { public void Initialize(InitializationEngine context) { MetadataHandlerRegistry handlerRegistry = ServiceLocator.Current.GetInstance();
IEnumerable metadataHandlers = handlerRegistry.GetMetadataHandlers(typeof(ContentData));
IMetadataProvider metadataProvider = (IMetadataProvider)metadataHandlers.First(i => i is IMetadataProvider);
IMetadataProvider customMetadataProvider = new CustomMetadataProvider(metadataProvider);
handlerRegistry.RegisterMetadataHandler(typeof(ContentData), customMetadataProvider );
}
public void Preload(string[] parameters) { }
public void Uninitialize(InitializationEngine context) { }
}
}
after this im getting field without any input to put value and when I'm trying to add ClientEditingClass to my custom dojo widget - page stops to display with message that metadataProvider can not be resolved.
There is no official documentation how to use the API and how to create ExtendedMetadata properly. Is it possible to get information how it should be used?