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
Prev Previous commit
Next Next commit
Supporting nullable types
  • Loading branch information
petero-dk committed Apr 15, 2019
commit 890f60c58cd723c04257991f804f4cfb618f7977
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ public static void SetValueFromEntityProperty(this PropertyInfo property, Object
// handle colleciton s
if (isCollection)
propertyType = property.PropertyType.GenericTypeArguments[0];

switch (entityProperty.PropertyType)

var nullableUnderlyingType = Nullable.GetUnderlyingType(propertyType);
if (nullableUnderlyingType != null)
propertyType = nullableUnderlyingType;

switch (entityProperty.PropertyType)
{
case EdmType.String:
if (propertyType.IsEnum && int.TryParse(entityProperty.StringValue, out var intEnum) && propertyType.IsEnumDefined(intEnum))
Expand Down