Exemple #1
0
        public async Task DapperUpdateAsync()
        {
            LoginUser bu = await DapperDataAsync.GetAsync <LoginUser>(2, null, null);

            bu.UserName = "******";
            bu.Del      = false;
            LoginUser newbu = await DapperDataAsync.UpdateAsync <LoginUser>(bu, null, null);

            Assert.AreEqual("tester", newbu.UserName);
        }
Exemple #2
0
        public async Task DapperInsert()
        {
            LoginUser bu = await DapperDataAsync.GetAsync <LoginUser>(2, null, null);

            bu.UserCode = "testNo2";
            bu.UserName = "******";

            int id = await DapperDataAsync.InsertAsync <LoginUser>(bu, null, null);

            Assert.AreEqual(6, id);
        }
 /// <summary>
 /// 获取Model-Key为long类型
 /// </summary>
 /// <param name="id"></param>
 /// <param name="transaction"></param>
 /// <param name="commandTimeout"></param>
 /// <returns></returns>
 public async Task <T> GetAsync(long id, IDbTransaction transaction = null, int?commandTimeout = null)
 {
     return(await DapperDataAsync.GetAsync <T>(id, transaction, commandTimeout));
 }
Exemple #4
0
        public async Task DapperGetAsync()
        {
            LoginUser bu = await DapperDataAsync.GetAsync <LoginUser>(1, null, null);

            Assert.AreEqual("sadmin", bu.UserName);
        }