用Dapper调用存储过程

【用Dapper调用存储过程】临文乍了了,彻卷兀若无。这篇文章主要讲述用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 = https://www.songbingjia.com/android/conn.Query< GoodsModel> ("G_Page", sp, commandType: CommandType.StoredProcedure).ToList(), TotalCount = sp.Get< int> ("@TotalCount") }; if (Gid!=0) { model.data= https://www.songbingjia.com/android/model.data.Where(s=> s.Gid==Gid).ToList(); } return model; }


    推荐阅读