Models: PropertyType constructor sets the DataTypeKey if IDataType has identity (#20301)

* PropertyType constructor sets the DataTypeKey if passed IDataType has identity

* Updated unit tests to verify behaviour.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
Pantelis
2025-09-30 08:18:26 +03:00
committed by GitHub
parent 82fc41a459
commit 65393ff3d9
5 changed files with 44 additions and 5 deletions

View File

@@ -24,6 +24,9 @@ public interface IPropertyType : IEntity, IRememberBeingDirty
/// </summary>
int DataTypeId { get; set; }
/// <summary>
/// Gets or sets the Guid unique identifier of the datatype for this property type.
/// </summary>
Guid DataTypeKey { get; set; }
/// <summary>

View File

@@ -47,6 +47,7 @@ public class PropertyType : EntityBase, IPropertyType, IEquatable<PropertyType>
if (dataType.HasIdentity)
{
_dataTypeId = dataType.Id;
_dataTypeKey = dataType.Key;
}
_propertyEditorAlias = dataType.EditorAlias;
@@ -159,6 +160,7 @@ public class PropertyType : EntityBase, IPropertyType, IEquatable<PropertyType>
set => SetPropertyValueAndDetectChanges(value, ref _dataTypeId, nameof(DataTypeId));
}
/// <inheritdoc />
[DataMember]
public Guid DataTypeKey
{