object[] ExecuteProc(string procName, paramsDbParameter[] parms)
{
MyDbContext dbContext= this.GetDbContext(AccessMode.Write);using (var conn = newOracleConnection(dbContext.Database.Connection.ConnectionString))
{
List outParms = parms.Where(p => p.Direction == System.Data.ParameterDirection.Output || p.Direction ==System.Data.ParameterDirection.ReturnValue).ToList();
OracleCommand command= newOracleCommand(procName);
command.Connection=conn;
command.CommandType=CommandType.StoredProcedure;
command.Parameters.AddRange(parms);
conn.Open();
command.ExecuteNonQuery();
command.Parameters.Clear();
command.Dispose();
conn.Close();object[] values = outParms.Select(r =>r.Value).ToArray();returnvalues;
}
}
调用
BaseRepository resp = newBaseRepository();var p3 = resp.GetParameterOut("COUNT_ROW", System.Data.DbType.Int32, 4);object[] o = resp.ExecuteProc("PROC1", p3);var ss = p3.Value;
EF CODEFIRST WITH ORACLE 存储过程
标签:方案 class data 需要 out return command codefirst val
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉 本文系统来源:http://www.cnblogs.com/njcxwz/p/6510823.html