我使用Custom TYPE参数创建了一个样本存储过程 它在SQL中完美执行,但我无法将其附加到EDMX(EF 6)。
CREATE TYPE dbo.ArrayINT
AS TABLE
(
Value INT
);
GO
CREATE PROCEDURE DeleteItems
(
@IDs dbo.ArrayINT READONLY
) AS
BEGIN
//...Logic to delete
END
答案 0 :(得分:0)
没有直接的方法可以做到这一点。但您可以使用ExecuteSqlCommand
和datatable
:
var context = new TSQL2012Entities();
var table = new DataTable();
table.Columns.Add("SomeColumn1");
table.Columns.Add("SomeColumn2");
table.Rows.Add(someValue11, someValue21);
table.Rows.Add(someValue21, someValue22);
var param = new SqlParameter("param1", SqlDbType.Structured);
param.Value = table;
param.TypeName = "[dbo].[YourTableType]";
string command = "EXEC spProcName @param1";
context.Database.ExecuteSqlCommand(command, param);