Skip to content

Commit

Permalink
Review.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcweber committed Jan 12, 2021
1 parent 1445673 commit f2393fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
14 changes: 4 additions & 10 deletions src/ExRam.Gremlinq.Core/Environment/GremlinQueryEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,12 @@ public static IGremlinQueryEnvironment StoreTimeSpansAsNumbers(this IGremlinQuer
return environment
.ConfigureSerializer(serializer => serializer
.ConfigureFragmentSerializer(fragmentSerializer => fragmentSerializer
.Override<TimeSpan>((t, env, overridden, recurse) =>
{
return recurse.Serialize(t.TotalMilliseconds, env);
})))
.Override<TimeSpan>((t, env, overridden, recurse) => recurse.Serialize(t.TotalMilliseconds, env))))
.ConfigureDeserializer(deserializer => deserializer
.ConfigureFragmentDeserializer(fragmentDeserializer => fragmentDeserializer
.Override<JValue>((jValue, type, env, overridden, recurse) =>
{
return type == typeof(TimeSpan)
? TimeSpan.FromMilliseconds(jValue.Value<double>())
: overridden(jValue, type, env, recurse);
})));
.Override<JValue>((jValue, type, env, overridden, recurse) => type == typeof(TimeSpan)
? TimeSpan.FromMilliseconds(jValue.Value<double>())
: overridden(jValue, type, env, recurse))));
}
}
}
1 change: 1 addition & 0 deletions src/ExRam.Gremlinq.Core/Extensions/ObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static object GetId(this object element, IGremlinQueryEnvironment environ
var (propertyInfo, _, _) = environment.GetCache().GetSerializationData(element.GetType())
.FirstOrDefault(info => info.key.RawKey is T t && T.Id.Equals(t));

// ReSharper disable once ConstantConditionalAccessQualifier
return propertyInfo?.GetValue(element) is { } value
? value
: throw new InvalidOperationException($"Unable to determine Id for {element}");
Expand Down
4 changes: 2 additions & 2 deletions test/ExRam.Gremlinq.Core.Tests/QueryExecutionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,7 @@ await _g
.V<Company>()
.Properties(x => x.Locations!)
.Properties()
.Where(x => x.Key! == stepLabel))
.Where(x => x.Key == stepLabel))
.Verify(this);
}

Expand Down Expand Up @@ -2914,7 +2914,7 @@ await _g
.As((__, l) => __
.V<Country>()
.Properties(x => x.Languages!)
.Where(x => x.Label! == l))
.Where(x => x.Label == l))
.Verify(this);
}

Expand Down

0 comments on commit f2393fe

Please sign in to comment.