public ServiceElement(SerialOid oid, string id) { Assert.AssertNotNull("oid", oid); Assert.AssertNotNull("id", id); this.oid = oid; this.id = id; typeName = oid.Specification.FullName; oid.Specification.MarkAsService(); }
public SerialOid(string[] strings) { var helper = new StringDecoderHelper(strings); typeName = helper.GetNextString(); serialNo = helper.GetNextLong(); isTransient = helper.GetNextBool(); if (helper.HasNext) { bool hasPrevious = helper.GetNextBool(); if (hasPrevious) { previous = (SerialOid) helper.GetNextEncodedToStrings(); } } CacheState(); }
private static string EncodedOid(SerialOid oid) { return oid.SerialNo.ToString("x").ToUpper(); }
// Overloaded to allow compiler to link directly if we know the compile-time type. // TODO (possible performance improvement - called 166,000 times in normal ref data fixture public bool Equals(SerialOid otherOid) { if (otherOid == this) { return true; } return otherOid.serialNo == serialNo && otherOid.isTransient == isTransient; }
internal void MakePersistent(long newSerialNo) { Assert.AssertTrue("Attempting to make persistent a non transient oid", isTransient); previous = new SerialOid(serialNo, typeName, isTransient); serialNo = newSerialNo; isTransient = false; CacheState(); }
public virtual void TestInsertObjectWithOneToManyAssociations() { ObjectData data = CreateData(typeof(Team), 99, new FileVersion("user", 13)); data.InitCollection("Members"); SerialOid[] oid = new SerialOid[3]; for (int i = 0; i < oid.Length; i++) { oid[i] = SerialOid.CreatePersistent(104 + i, typeof(Team).FullName); data.AddElement("Members", oid[i]); } manager.InsertObject(data); ObjectData read = manager.LoadObjectData(data.Oid); Assert.AreEqual(data.Oid, read.Oid); Assert.AreEqual(data.ClassName, read.ClassName); IList<IOid> c = read.Elements("Members"); for (int i = 0; i < oid.Length; i++) { Assert.AreEqual(oid[i], c[i]); } }