From 57f937cfa824fe8bb0566ea7fc03b17919381c1d Mon Sep 17 00:00:00 2001 From: "JUSTUSWORKPC\\Justus" Date: Thu, 24 Nov 2016 15:13:24 +0100 Subject: [PATCH] Fixed updating relationships, when no attributes are specified. --- src/NJsonApiCore.Web.MVCCore.HelloWorld/Models/Person.cs | 4 ++++ src/NJsonApiCore/ResourceMapping.cs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/NJsonApiCore.Web.MVCCore.HelloWorld/Models/Person.cs b/src/NJsonApiCore.Web.MVCCore.HelloWorld/Models/Person.cs index 7643577..a089346 100644 --- a/src/NJsonApiCore.Web.MVCCore.HelloWorld/Models/Person.cs +++ b/src/NJsonApiCore.Web.MVCCore.HelloWorld/Models/Person.cs @@ -2,6 +2,10 @@ { public class Person { + public Person() + { + } + public Person(string firstname, string lastname, string twitter) { Id = StaticPersistentStore.GetNextId(); diff --git a/src/NJsonApiCore/ResourceMapping.cs b/src/NJsonApiCore/ResourceMapping.cs index 1c84d16..c1025d5 100644 --- a/src/NJsonApiCore/ResourceMapping.cs +++ b/src/NJsonApiCore/ResourceMapping.cs @@ -78,8 +78,14 @@ public Dictionary GetAttributes(object objectGraph) // TODO ROLA - type handling must be better in here public Dictionary GetValuesFromAttributes(Dictionary attributes) { + var values = new Dictionary(); + if (attributes == null) + { + return values; + } + foreach (var propertySetter in PropertySettersExpressions) { object value;