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:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user