Saturday, 15 August 2015

linq to sql - Create a return type based on table-valued function -



linq to sql - Create a return type based on table-valued function -

i have grouping of table-valued functions homecoming datasets same construction (same column names, types , order).

if drag functions linq2sql designer, designer create new anonymous result type each of functions, , functions not compatible result-wise.

to tell designer functions have same result type, need drag functions onto existing linq2sql class.

that fine, have manually create class every time (insert new table in designer area, press insert many times insert columns, type in column names, client-side info types , server-side info types). can time-consuming if there many columns , many functions.

is there way tell designer automatically create entity (table class) looking @ table-valued function, can drag rest of functions onto entity?

my current workaround is:

create view on server:

class="lang-sql prettyprint-override">create view dbo.stupid_linq select * dbo.functioniwant(bogus_params);

drag view designer, creates entity.

unlink entity database deleting source.

rename entity.

delete view on server.

drag table-valued functions onto entity.

linq-to-sql orm user-defined-functions return-type

No comments:

Post a Comment