用Dapper调用存储过程

public PageModel Get(int PageIndex = 1, int PageSize = 5, int Pid = 0, int Tid = 0, int Gid = 0)
        {
            DynamicParameters sp = new DynamicParameters();
            sp.Add("@PageIndex", PageIndex);
            sp.Add("@PageSize", PageSize);
            sp.Add("@Pid", Pid);
            sp.Add("@Tid", Tid);
            sp.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
            PageModel model = new PageModel()
            {
                data = conn.Query<GoodsModel>("G_Page", sp, commandType: CommandType.StoredProcedure).ToList(),
                TotalCount = sp.Get<int>("@TotalCount")
            };
            if (Gid!=0)
            {
               model.data= model.data.Where(s=>s.Gid==Gid).ToList();
            }
            return model;
        }

用Dapper调用存储过程

上一篇:iphone上传拍照图片时图片会旋转90度,从相册选择就不会,安卓手机也不会,怎么解决?


下一篇:iOS - 创建可以在 InterfaceBuilder 中实时预览的自定义控件