Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Parsing of enums from storage
  • Loading branch information
petero-dk committed Apr 15, 2019
commit 11eb38fb2511bed25da16293545a76fd948a5ef4
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ public static void SetValueFromEntityProperty(this PropertyInfo property, Object
switch (entityProperty.PropertyType)
{
case EdmType.String:
if (propertyType != typeof(string))
break;
if (propertyType.IsEnum && int.TryParse(entityProperty.StringValue, out var intEnum) && propertyType.IsEnumDefined(intEnum))
property.SetOrAddValue(entity, Enum.ToObject(property.PropertyType, intEnum), isCollection);
else if (propertyType.IsEnum && propertyType.IsEnumDefined(entityProperty.StringValue))
property.SetOrAddValue(entity, Enum.ToObject(property.PropertyType, entityProperty.StringValue), isCollection);

property.SetOrAddValue(entity, entityProperty.StringValue, isCollection);
break;
case EdmType.Binary:
else if (propertyType == typeof(string))
property.SetOrAddValue(entity, entityProperty.StringValue, isCollection);

break;
case EdmType.Binary:
if (propertyType != typeof(byte[]))
break;

Expand Down