Skip to content

Commit c2fb45d

Browse files
committed
Merge pull request #75 from csantero/any-id
allow using any type as an ID property
2 parents e55a851 + 1582663 commit c2fb45d

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

JSONAPI/Json/JsonApiFormatter.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,14 +1062,7 @@ protected string GetValueForIdProperty(PropertyInfo idprop, object obj)
10621062
{
10631063
if (idprop != null)
10641064
{
1065-
if (idprop.PropertyType == typeof(string))
1066-
return (string)idprop.GetValue(obj, null);
1067-
if (idprop.PropertyType == typeof(Guid))
1068-
return idprop.GetValue(obj).ToString();
1069-
if (idprop.PropertyType == typeof(int))
1070-
return ((int)idprop.GetValue(obj, null)).ToString();
1071-
if (idprop.PropertyType == typeof(byte))
1072-
return ((byte)idprop.GetValue(obj, null)).ToString();
1065+
return idprop.GetValue(obj).ToString();
10731066
}
10741067
return "NOIDCOMPUTABLE!";
10751068
}

0 commit comments

Comments
 (0)