示例#1
0
        public void NoPropertyAttribute()
        {
            TAttNoSaveAll objNoSave = new TAttNoSaveAll();

            Assert.AreEqual(2, Entity.GetInfo(objNoSave).SavedPropertyList.Count);     // object has a default property "Id"

            TAttWithSaveAll objSaved = new TAttWithSaveAll();

            Assert.AreEqual(4, Entity.GetInfo(objSaved).SavedPropertyList.Count);

            string nameValue = "zhangsan";

            objNoSave.Name = nameValue;
            db.insert(objNoSave);

            objSaved.Name = nameValue;
            db.insert(objSaved);

            TAttNoSaveAll objZhang = TAttNoSaveAll.findById(1);

            Assert.IsNotNull(objZhang);
            Assert.IsNull(objZhang.Name);

            TAttWithSaveAll objZhangsan = TAttWithSaveAll.findById(1);

            Assert.AreEqual(nameValue, objZhangsan.Name);
        }
示例#2
0
        public void NoPropertyAttribute()
        {
            TAttNoSaveAll objNoSave = new TAttNoSaveAll();
            Assert.AreEqual( 2, Entity.GetInfo( objNoSave ).SavedPropertyList.Count ); // object has a default property "Id"

            TAttWithSaveAll objSaved = new TAttWithSaveAll();
            Assert.AreEqual( 4, Entity.GetInfo( objSaved ).SavedPropertyList.Count );

            string nameValue = "zhangsan";

            objNoSave.Name = nameValue;
            db.insert( objNoSave );

            objSaved.Name = nameValue;
            db.insert( objSaved );

            TAttNoSaveAll objZhang = TAttNoSaveAll.findById( 1 );
            Assert.IsNotNull( objZhang );
            Assert.IsNull( objZhang.Name );

            TAttWithSaveAll objZhangsan = TAttWithSaveAll.findById( 1 );
            Assert.AreEqual( nameValue, objZhangsan.Name );
        }