단일값 반환
var param = new SqlParameter { ParameterName = "idx", Value = 1 }; var result = context.Database.SqlQuery("ProcedureName @idx", param); return result.FirstOrDefaultAsync().Result;
리스트 반환
context.Database.SqlQuery("GetPerson").AsQueryable();
Output parameter
var param = new SqlParameter { ParameterName = "idx", Value = 1 }; var output_param = new SqlParameter { ParameterName = "ResultCode", Value = 0, Direction = ParameterDirection.Output }; var result = context.Database.SqlQuery("GetPersons @idx, @ResultCode out", param, output_param).AsQueryable(); var resultCode = (int)output_param.Value;
댓글 없음:
댓글 쓰기