示例#1
0
        public override IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr)
        {
            var baseResult = base.FromStream(sr);

            sr.Read(out this._Value);
            sr.Read(out this._fk_Parent);
            return(baseResult);
        }
示例#2
0
 public IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr)
 {
     sr.Read(out _ID);
     sr.Read(out _StringProperty);
     sr.Read(out _IntProperty);
     sr.Read(out _BoolProperty);
     return(null);
 }
示例#3
0
        public override IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader binStream)
        {
            var baseResult = base.FromStream(binStream);

            binStream.Read(out this._MyIntProperty);
            binStream.Read(out this._fk_ObjectProp);
            binStream.Read(out this._StringProp);
            {
                int?baseValue;
                binStream.Read(out baseValue);
                ((TestObjClass)this).TestEnumProp = (Zetbox.App.Test.TestEnum)baseValue;
            }
            return(baseResult);
        }
示例#4
0
 public IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader sr)
 {
     sr.Read(out _ID);
     sr.Read(out _StringProperty);
     sr.Read(out _IntProperty);
     sr.Read(out _BoolProperty);
     return null;
 }
示例#5
0
        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");
        }
示例#6
0
 public IEnumerable <IPersistenceObject> FromStream(ZetboxStreamReader sr)
 {
     sr.Read(out _ID);
     sr.Read(out _TestName);
     return(null);
 }
示例#7
0
 public override IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader binStream)
 {
     var baseResult = base.FromStream(binStream);
     binStream.Read(out this._MyIntProperty);
     binStream.Read(out this._fk_ObjectProp);
     binStream.Read(out this._StringProp);
     {
         int? baseValue;
         binStream.Read(out baseValue);
         ((TestObjClass)this).TestEnumProp = (Zetbox.App.Test.TestEnum)baseValue;
     }
     return baseResult;
 }
示例#8
0
 public IEnumerable<IPersistenceObject> FromStream(ZetboxStreamReader sr)
 {
     sr.Read(out _ID);
     sr.Read(out _TestName);
     return null;
 }