user1939553
user1939553

Reputation: 79

EF generate result objects for SQL OUTPUT clause

What can I do so that EF becomes aware of the output clause in SPs and generates the result object accordingly?

   INSERT INTO goodtable
   (token,
   ip, long_ip,
  ) OUTPUT INSERTED.*
  VALUES
   (@token,
   @ip, @long_ip,
 );

What I currently do to circumvent this is writing a dummy select, generate the objects and the comment out the dummy select leaving the output. This is not a good solution for a long term run.

Please do not suggest changing the SQL.

Upvotes: 1

Views: 376

Answers (1)

Peter Smith
Peter Smith

Reputation: 5550

Have you tried. when importing the stored procedure into EF, using function import, to add the returns a collection of option. This is the dialog

I've never tried it, but can't see a reason for it not to work.

Upvotes: 1

Related Questions