I
I
iambot2010-12-28 10:55:03
SQL
iambot, 2010-12-28 10:55:03

How to make .net's linq2sql friends with storages that return different types of tables

There are storages of the form: Which, depending on the input parameters, return different tables. In fact, these are wrappers for working with data. But linq can't determine the return type itself. I would like to point it out to him. Is that possible?


IF @AccessEnabled = 1
BEGIN
IF @StartDate is null
SET @StartDate = '01/01/1900'
IF @EndDate is null
SET @EndDate = GETDATE()
IF @ReportType is null
SET @ReportType = 1

IF @ReportType = 1
BEGIN




Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Angelina_Joulie, 2010-12-28
@Angelina_Joulie

How do you imagine using it?
what would it then return System.Object and after that you checked, and what parameters were passed and what object was obtained based on this?
You don't feel like you're on the wrong path.
And on the merits of the question, I will say the following: the designer has limitations and with dynamic queries, complex storage - it works, this is a limitation that cannot be managed with simple methods. but you always have the opportunity to tweak everything manually in .designer.cs to explicitly specify the data type.
but, again, at the slightest attempt to use the designer, the code will be returned to its original state and corrections will have to be made again.
but... and here there are games with partial fnctions

A
Angelina_Joulie, 2010-12-28
@Angelina_Joulie

Sorry, the iPad is dumb.
I wanted to say: DOES NOT WORK with complex stored procedures

V
Voucik, 2013-11-25
@Voucik

As for LINQ itself, here is the link.
http://professorweb.ru/my/LINQ/base/level1/info_linq.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question