示例#1
0
        public void TestPKKey <T>(Expression <Func <MyDataKeys, T> > pkGetter, Action <MyDataKeys, T> pkSetter, T key)
        {
            var db = new DbInstance("DbKeys");

            db.Map <MyDataKeys>().Key(pkGetter);
            db.Initialize();
            var getter = pkGetter.Compile();
            var obj1   = new MyDataKeys();

            pkSetter(obj1, key);
            db.Save(obj1);

            var obj2 = db.LoadByKey <MyDataKeys>(key);

            Assert.AreEqual(getter(obj1), getter(obj2));

            db.Purge();
        }