In version 7 I had a piece of code that created a new DataTypeDefinition, but I am not being able to find it's counterpart in version 8, any suggestions?
And the IDataTypeService doesn't have a GetDataTypeDefinitionByPropertyEditorAlias method anymore either
DataTypeDefinition dataType = null;
if (!exists)
dataType = new DataTypeDefinition(containerId, alias);
else
dataType = _dataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(alias).First() as DataTypeDefinition;
dataType.Name = name;
dataType.PropertyEditorAlias = propertiEditor;
I have been fiddling with the code and search for a way around this. Let me share the background of what my code used to do in version 7, and you can tell me if what has changed in version 8:
The code was creating a new DateType so it could be consumed by the PropertyEditor.
It seems that no longer applies. What should I do? When I create the DataEditor class (with correct attributes), will it create the DataType automatically?
Migration v7 DataTypeDefinition to v8
Hello Folks,
In version 7 I had a piece of code that created a new DataTypeDefinition, but I am not being able to find it's counterpart in version 8, any suggestions?
And the IDataTypeService doesn't have a
GetDataTypeDefinitionByPropertyEditorAlias
method anymore eitherHi Carlos,
I think the method has been renamed to
GetByEditorAlias(alias)
in V8Can you try if that works for you ?
Dave
Yes Dave,
GetByEditorAlias
has worked. Thank you!But I still haven't found a substitute for
DataTypeDefinition
, any suggestions?Hi Carlos,
This method now returns a type of IDataType : https://github.com/umbraco/Umbraco-CMS/blob/853087a75044b814df458457dc9a1f778cc89749/src/Umbraco.Core/Models/IDataType.cs
I think that has replaced DataTypeDefinition.
Dave
Yes Dave,
I have been fiddling with the code and search for a way around this. Let me share the background of what my code used to do in version 7, and you can tell me if what has changed in version 8:
The code was creating a new DateType so it could be consumed by the PropertyEditor.
It seems that no longer applies. What should I do? When I create the DataEditor class (with correct attributes), will it create the DataType automatically?
Hi Carlos,
I haven't done that much with V8 yet. But I guess you need to use the save method of the datatype service
https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Services.Implement.DataTypeService.html#UmbracoCoreServicesImplementDataTypeServiceSaveUmbracoCoreModelsIDataTypeSystemInt32
Dave
This is related https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/97597-creating-custom-data-type
is working on a reply...