private static void EncodeDurableNamedMapEntry(Stream stream, string name, Durable.Def def, object x) { if (string.IsNullOrWhiteSpace(name)) { throw new InvalidOperationException( $"Empty names are not allowed. Invariant f3549a31-7d59-4701-b1c5-65f0db93fedd." ); } var key = (def.Type != Durable.Primitives.Unit.Id) ? def.Type : def.Id; if (s_encoders.TryGetValue(key, out var encoder)) { EncodeStringUtf8(stream, name); EncodeGuid(stream, def.Id); ((Action <Stream, object>)encoder)(stream, x); } else { var unknownDef = Durable.Get(key); throw new InvalidOperationException( $"No encoder for {unknownDef}. Invariant d30925d5-2c7f-4f30-871a-9fca4413200c." ); } }
public void ComparableTest() { var a = new Durable.Def(Guid.NewGuid(), "test", "test", Durable.Primitives.Unit.Id, false); var b = new Durable.Def(Guid.NewGuid(), "test", "test", Durable.Primitives.Unit.Id, false); Assert.True(a.CompareTo(a) == 0); Assert.True(a.CompareTo(b).Sign() == b.CompareTo(a).Sign() * -1); Assert.True(a.CompareTo(null) == 1); }
public void EqualsTest() { var a = new Durable.Def(Guid.NewGuid(), "test", "test", Durable.Primitives.Unit.Id, false); var b = new Durable.Def(Guid.NewGuid(), "test", "test", Durable.Primitives.Unit.Id, false); Assert.True(a.Equals((object)a)); Assert.True(b.Equals((object)b)); Assert.False(a.Equals((object)b)); Assert.False(a.Equals((object)null)); Assert.False(b.Equals((object)a)); Assert.False(b.Equals((object)null)); }
private static void EncodeDurableMapEntry(BinaryWriter stream, Durable.Def def, object x) { var key = (def.Type != Durable.Primitives.Unit.Id) ? def.Type : def.Id; if (s_encoders.TryGetValue(key, out var encoder)) { EncodeGuid(stream, def.Id); ((Action <BinaryWriter, object>)encoder)(stream, x); } else { var unknownDef = Durable.Get(key); throw new InvalidOperationException( $"No encoder for {unknownDef}. Invariant 723c80aa-dfe4-4da9-9922-1f3c3c39aac0." ); } }
private static void EncodeDurableMapEntry(Stream stream, Durable.Def def, object x) { var key = (def.Type != Durable.Primitives.Unit.Id) ? def.Type : def.Id; if (s_encoders.TryGetValue(key, out var encoder)) { EncodeGuid(stream, def.Id); ((Action <Stream, object>)encoder)(stream, x); } else { var unknownDef = Durable.Get(key); throw new InvalidOperationException( $"No encoder for {unknownDef}. Invariant 63e28e62-1c7b-4ed6-9945-f6d469bee271." ); } }
private static void EncodeDurableNamedMapEntry(BinaryWriter stream, string name, Durable.Def def, object x) { if (string.IsNullOrWhiteSpace(name)) { throw new InvalidOperationException( $"Empty names are not allowed. Invariant 48ff333e-250b-48f1-ae56-2129e9370d70." ); } var key = (def.Type != Durable.Primitives.Unit.Id) ? def.Type : def.Id; if (s_encoders.TryGetValue(key, out var encoder)) { EncodeStringUtf8(stream, name); EncodeGuid(stream, def.Id); ((Action <BinaryWriter, object>)encoder)(stream, x); } else { var unknownDef = Durable.Get(key); throw new InvalidOperationException( $"No encoder for {unknownDef}. Invariant b5a5a7d1-1c3c-4b63-ad97-0f072b513446." ); } }
/// <summary> /// </summary> public static Func <BinaryReader, object> GetDecoderFor(Durable.Def def) => (Func <BinaryReader, object>)s_decoders[def.Id];
/// <summary> /// Filtered not does not support WithUpsert. /// </summary> public IPointCloudNode WithUpsert(Durable.Def def, object x) => throw new InvalidOperationException("Invariant 3de7dad1-668d-4104-838b-552eae03f7a8.");
/// <summary></summary> public DurableGZipped(Durable.Def def, object value) { Def = def ?? throw new ArgumentNullException(nameof(def)); Value = value ?? throw new ArgumentNullException(nameof(value)); }