Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I are trying to create a data type in c# but getting stuck.
Umbraco8
var exists = current.PropertyEditor.TryGet(alias, out editor); if (!exists) { DataType newDataType = new DataType(editor) ....... }
umbraco9 so far
IDataType editor = _dataTypeService.GetByEditorAlias(docType).FirstOrDefault(); if (editor == null) { var serializer = new IConfigurationEditorJsonSerializer(); DataType newDataType = new DataType(editor.Editor, serializer, containerId); ............ }
as per https://our.umbraco.com/Documentation/Reference/Management/Models/DataType
how ever I cant find any implementation on what I supposed to do with IConfigurationEditorJsonSerializer hence the guess in the line.
any suggestions would be great.
Found the answer
public class abc private readonly IConfigurationEditorJsonSerializer _serializer; public IBDInstallService(IPublishedContentQuery publishedContentQuery, IDataTypeService dataTypeService, IConfigurationEditorJsonSerializer serializer, IShortStringHelper shortStringHelper) { _dataTypeService = dataTypeService; _serializer = serializer; _shortStringHelper = shortStringHelper; } public void Create DataType () { ...... var editor = _dataTypeService.GetByEditorAlias(docType).FirstOrDefault(); if (editor != null) { DataType newDataType = new DataType(editor.Editor, _serializer, containerId); ......... }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Porting dataType creation in c# from8 to 9
I are trying to create a data type in c# but getting stuck.
Umbraco8
umbraco9 so far
as per https://our.umbraco.com/Documentation/Reference/Management/Models/DataType
how ever I cant find any implementation on what I supposed to do with IConfigurationEditorJsonSerializer hence the guess in the line.
any suggestions would be great.
Found the answer
is working on a reply...