DataTable ActivityRoutineParameter = new DataTable();
ActivityRoutineParameter.Columns.Add("p1", typeof(long));
ActivityRoutineParameter.Columns.Add("p2", typeof(long));
System.Data.Objects.ObjectParameter[] objValParams = new System.Data.Objects.ObjectParameter[2];
objValParams[0] = new System.Data.Objects.ObjectParameter("@tvpActivityRoutineParameter", ActivityRoutineParameter);
System.Data.Objects.ObjectParameter objValidationResult = new System.Data.Objects.ObjectParameter("xmlResult", typeof(System.String));
objValParams[1] = objValidationResult;
var varResponse = context.ExecuteFunction("uspValidation1", objValParams);
CREATE TYPE ActivityRoutineParameter AS TABLE ( PipeFromId BIGINT NULL ,PipeToId BIGINT NULL ) GO
CREATE PROCEDURE uspValidation1 @tvpActivityRoutineParameter dbo.ActivityRoutineParameter READONLY, @xmlResult [xml] = null OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SELECT
@xmlResult END GO
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
16 Points
172 Posts
how to call tvp from ExecuteFuntion.
Dec 01, 2020 10:46 AM|rajemessage|LINK
hi , is it the right way
CREATE TYPE ActivityRoutineParameter AS TABLE ( PipeFromId BIGINT NULL ,PipeToId BIGINT NULL ) GO
CREATE PROCEDURE uspValidation1 @tvpActivityRoutineParameter dbo.ActivityRoutineParameter READONLY, @xmlResult [xml] = null OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SELECT @xmlResult END GO
Participant
1780 Points
557 Posts
Re: how to call tvp from ExecuteFuntion.
Dec 03, 2020 02:28 AM|XuDong Peng|LINK
Hi rahemessage,
Regarding the ExecutiveFunction you mentioned, which one are you using?
System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction() or System.Data.Objects.ObjectContext.ExecuteFunction() ?
If you want to use this feature in Entity Framework, I recommand that you could read or refer to the these documents:
Table-Valued Function Support-MSDN Document
Entity Framework Tutorial-Table-Valued Function
Best regards
Xudong Peng
Member
16 Points
172 Posts
Re: how to call tvp from ExecuteFuntion.
Dec 03, 2020 07:33 AM|rajemessage|LINK
System.Data.Objects.ObjectContext.ExecuteFunction()