Exemplo n.º 1
0
 public ProductCategory Get(Guid code)
 {
     try
     {
         return(_commonDb.ExecuteScalar <ProductCategory>("select * from categories where code = @code", new { code }));
     }
     catch (Exception e)
     {
         throw new CategoryOperationException($"Category with code {code} get error!", e);
     }
 }
 public int GetPageCount(int pageSize)
 {
     try
     {
         var count = _commonDb.ExecuteScalar <int>($"select count(1) from units");
         return(count / pageSize + count % pageSize);
     }
     catch (Exception e)
     {
         throw new ProductUnitOperationException($"Units get page size error!", e);
     }
 }
Exemplo n.º 3
0
 private bool MigrateExists(string migrateName)
 {
     return(_commonDb.ExecuteScalar <bool>("select top 1 cast(isExist as bit) from (select 1 as isExist from __Migrations where name = @name union all select 0) s1", new { name = migrateName }));
 }