public void Can_execute_update_using_expression()
        {
            using (var con = OpenDbConnection())
            {
                con.CreateTable<SimpleType>(true);
                var obj = new SimpleType { Name = "Somename" };
                con.Save(obj);
                var storedObj = con.SingleById<SimpleType>(con.LastInsertId());

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

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

                var target = con.SingleById<SimpleType>(storedObj.Id);

                Assert.AreEqual(obj.Name, target.Name);
            }
        }
        public void Can_GetLastInsertedId_using_InsertParam()
        {
            var testObject = new SimpleType { Name = "test" };

            //verify that "normal" Insert works as expected
            using (var con = OpenDbConnection())
            {
                con.CreateTable<SimpleType>(true);

                con.Save(testObject);
                Assert.That(testObject.Id, Is.GreaterThan(0), "normal Insert");
            }

            //test with InsertParam
            using (var con = OpenDbConnection())
            {
                con.CreateTable<SimpleType>(true);

                var lastInsertId = con.Insert(testObject, selectIdentity:true);
                Assert.That(lastInsertId, Is.GreaterThan(0), "with InsertParam");
            }
        }
		public void Can_GetLastInsertedId_using_InsertParam()
		{
			var testObject = new SimpleType { Name = "test" };

			//verify that "normal" Insert works as expected
			using(var con = ConnectionString.OpenDbConnection()) {
				con.CreateTable<SimpleType>(true);

				con.Insert(testObject);
				var normalLastInsertedId = con.GetLastInsertId();
				Assert.Greater(normalLastInsertedId, 0, "normal Insert");
			}

			//test with InsertParam
			using(var con = ConnectionString.OpenDbConnection()) {
				con.CreateTable<SimpleType>(true);

				con.InsertParam(testObject);
				var insertParamLastInsertedId = con.GetLastInsertId();
				Assert.Greater(insertParamLastInsertedId, 0, "with InsertParam");
			}
		}
        public void Can_execute_update_only()
        {
            using (var con = OpenDbConnection())
            {
                con.CreateTable<SimpleType>(true);
                var obj = new SimpleType { Name = "Somename" };
                con.Save(obj);
                var storedObj = con.SingleById<SimpleType>(con.LastInsertId());

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

                var ev = OrmLiteConfig.DialectProvider.SqlExpression<SimpleType>();
                ev.Update();
                ev.Where(q => q.Id == storedObj.Id); 
                storedObj.Name = "Someothername";

                con.UpdateOnly(storedObj, ev);

                var target = con.SingleById<SimpleType>(storedObj.Id);

                Assert.AreEqual("Someothername", target.Name);
            }
        }