Пример #1
0
		public void Can_execute_update_using_aliased_columns()
		{
			using (var con = OpenDbConnection())
			{
				con.CreateTable<SimpleAliasedType>(true);
				var obj = new SimpleAliasedType {Name = "Somename"};
				con.Save(obj);
				var storedObj = con.GetById<SimpleAliasedType>(con.GetLastInsertId());

				Assert.AreEqual(obj.Name, storedObj.Name);

				obj.Id = storedObj.Id;
				obj.Name = "Someothername";
				con.Update(obj);

				var target = con.GetById<SimpleAliasedType>(storedObj.Id);

				Assert.AreEqual(obj.Name, target.Name);
			}
		}
Пример #2
0
        public void Can_execute_update_using_aliased_columns()
        {
            using (var con = OpenDbConnection())
            {
                con.CreateTable <SimpleAliasedType>(true);
                var obj = new SimpleAliasedType {
                    Name = "Somename"
                };
                con.Save(obj);
                var storedObj = con.GetById <SimpleAliasedType>(con.GetLastInsertId());

                Assert.AreEqual(obj.Name, storedObj.Name);

                obj.Id   = storedObj.Id;
                obj.Name = "Someothername";
                con.Update(obj);

                var target = con.GetById <SimpleAliasedType>(storedObj.Id);

                Assert.AreEqual(obj.Name, target.Name);
            }
        }