存储过程:
ALTER PROCEDURE [dbo].[usp_test] @test int output AS BEGIN select @test =12; select 11; END
对应关系:
1.参数out,output均可以,都对应Dapper:
parameters.Add("@test", dbType: DbType.Int32, direction: ParameterDirection.Output); int m2 = parameters.Get<int>("@test");
2.存储过程中使用return语句,对应Dapper中的return参数:
parameters.Add("@OutPut1", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); int m3 = parameters.Get<int>("@OutPut1");
3.存储过程中的Select语句,与Dapper参数无对照关系,需要使用Query接口获取:
DynamicParameters parameters1 = new DynamicParameters(); parameters1.Add("@test", dbType: DbType.Int32, direction: ParameterDirection.Output); int zf = cn.QueryFirstOrDefault<int>("exec usp_test @test output", parameters1); int m2s = parameters1.Get<int>("@test");
标签:Return,parameters,int,test,Output,Dapper,parameters1 From: https://www.cnblogs.com/jizhong/p/17669618.html