public override IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); TestInt = sr.ReadInt32(); TestString = sr.ReadString(); return baseResult; }
public override IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); TestInt = sr.ReadInt32(); TestString = sr.ReadString(); return(baseResult); }
public override IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); sr.ReadConverter(i => ClientObjectState = (DataObjectState)i); sr.ReadInt32(); // ignore access permissions return(baseResult); }
public override IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); var result = new List <IPersistenceObject>(); this.fk_BaseTestObjClass = sr.ReadNullableInt32() ?? -1; this._StringProp = sr.ReadString(); this._TestEnumProp = (TestEnum)sr.ReadInt32(); sr.ReadCollectionEntries(this, this.TestNamesImpl); result.AddRange(this.TestNamesImpl.Cast <IPersistenceObject>()); return(baseResult == null ? result : result.Concat(baseResult)); }
public static void AssertCorrectContents <LOCALINTERFACE, ENUMTYPE>(ZetboxStreamReader sr, InterfaceType.Factory iftFactory) where LOCALINTERFACE : TestObjClass <LOCALINTERFACE, ENUMTYPE> where ENUMTYPE : struct { Assert.That(sr, Is.Not.Null, "no stream to inspect"); var objType = sr.ReadSerializableType(); Assert.That(objType, Is.EqualTo(GetSerializableType <LOCALINTERFACE, ENUMTYPE>(iftFactory)), "wrong interface type found"); var testObjId = sr.ReadInt32(); Assert.That(testObjId, Is.EqualTo(TestObjClassId), "wrong object ID found"); DataObjectState?objectState = null; sr.ReadConverter(i => objectState = (DataObjectState)i); Assert.That(objectState, Is.EqualTo(TestObjectState), "wrong ObjectState found"); int accessRights = sr.ReadInt32(); Assert.That(accessRights, Is.GreaterThan(0), "wrong Access Rights found"); // TestObjClass // BaseTestObjClass Reference int?testObjRefId; sr.Read(out testObjRefId); Assert.That(testObjRefId, Is.EqualTo(TestBaseClassId), "wrong BaseObjClass ID found"); // StringProp string testStringProp; sr.Read(out testStringProp); Assert.That(testStringProp, Is.EqualTo(TestStringPropValue), "wrong StringProp Value found"); //// SubClasses are not serialized, but fetched lazily //foreach (int subClassID in TestSubClassesIds) //{ // bool continuationMarkerForSubClasses = false; // BinarySerializer.FromStream(out continuationMarkerForSubClasses, sr); // Assert.That(continuationMarkerForSubClasses, Is.True, "wrong continuation marker for subClassId {0}", subClassID); // int readSubClassId; // BinarySerializer.FromStream(out readSubClassId, sr); // Assert.That(readSubClassId, Is.EqualTo(readSubClassId), "wrong subClassId read", subClassID); //} //bool continuationMarkerAfterSubClasses = false; //BinarySerializer.FromStream(out continuationMarkerAfterSubClasses, sr); //Assert.That(continuationMarkerAfterSubClasses, Is.False, "wrong continuation marker after subClassIds"); // TestEnumProp var testEnum = (TestEnum)sr.ReadInt32(); Assert.That(testEnum, Is.EqualTo(TestEnum.TestSerializationValue), "wrong enum value found"); // TestNames for (int i = 0; i < TestTestNamesIds.Length; i++) { var continuationMarkerForCes = sr.ReadBoolean(); Assert.That(continuationMarkerForCes, Is.True, "wrong continuation marker for testName #{0}", i); var ceType = sr.ReadSerializableType(); Assert.That(ceType, Is.EqualTo(GetSerializableCollectionEntryType <LOCALINTERFACE, ENUMTYPE>(iftFactory)), "wrong interface type found for collection entry #{0}", i); var readCeId = sr.ReadInt32(); Assert.That(readCeId, Is.EqualTo(TestTestNamesIds[i]), "wrong id read for collection entry #{0}", i); DataObjectState?ceObjectState = null; sr.ReadConverter(read => ceObjectState = (DataObjectState)read); Assert.That(ceObjectState, Is.EqualTo(TestCollectionEntryState), "wrong ObjectState found for collection entry #{0}", i); var readCeAccessRights = sr.ReadInt32(); Assert.That(readCeAccessRights, Is.GreaterThan(0), "wrong access rights for collection entry #{0}", i); var readValue = sr.ReadString(); Assert.That(readValue, Is.EqualTo(TestTestNamesValues[i]), "wrong value read for collection entry #{0}", i); } var continuationMarkerAfterCes = sr.ReadBoolean(); Assert.That(continuationMarkerAfterCes, Is.False, "wrong continuation marker after testNames collection entries"); }
public override IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); sr.ReadConverter(i => ClientObjectState = (DataObjectState)i); sr.ReadInt32(); // ignore access permissions return baseResult; }
public override IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader sr) { var baseResult = base.FromStream(sr); var result = new List<IPersistenceObject>(); this.fk_BaseTestObjClass = sr.ReadNullableInt32() ?? -1; this._StringProp = sr.ReadString(); this._TestEnumProp = (TestEnum)sr.ReadInt32(); sr.ReadCollectionEntries(this, this.TestNamesImpl); result.AddRange(this.TestNamesImpl.Cast<IPersistenceObject>()); return baseResult == null ? result : result.Concat(baseResult); }