public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // TODO: parse relation correctly // It is a workaround to allow Relation deserialization in tests, // we do not need to deserialize relations for anything else. var relationWithName = new DummyRelation() { RelationName = (string)reader.Value }; if (objectType == typeof(IRelation)) { return relationWithName; } else { var composedRelation = existingValue as ComposedRelation ?? new ComposedRelation(); composedRelation.Add(relationWithName); return composedRelation; } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // TODO: parse relation correctly // It is a workaround to allow Relation deserialization in tests, // we do not need to deserialize relations for anything else. var relationWithName = new DummyRelation() { RelationName = (string)reader.Value }; if (objectType == typeof(IRelation)) { return(relationWithName); } else { var composedRelation = existingValue as ComposedRelation ?? new ComposedRelation(); composedRelation.Add(relationWithName); return(composedRelation); } }