This is a migrated thread and some comments may be shown as answers.

[Solved] OUTER APPLY is not supported

3 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alexandre Jobin
Top achievements
Rank 1
Alexandre Jobin asked on 05 Nov 2010, 09:20 PM
hi!

i have a problem of "Outer Apply is not supported by Oracle" when i give this query to the Telerik Grid:

var data = from intervenant inIntervenants
        select new ViewModels.IntervenantGridViewModel()
        {
           IntervenantId = intervenant.IntervenantId,
           Code = intervenant.Code,
           Nom = intervenant.Nom,
           Municipalite = intervenant.Coordonnee.Adresses.FirstOrDefault().Municipalite
        };
 
var gridModel = new GridModel<ViewModels.IntervenantGridViewModel>()
{
   Data = data
};
 
return View(gridModel);

alone, this query work perfectly but when it is executed by the Telerik Grid, i get the "Outer Apply is not supported" exception. Do you have any idea why?

if i remove the "intervenant.Coordonnee.Adresses.FirstOrDefault().Municipalite" from the linq query, the grid is processing the linq query correctly.

So what are you adding to the query that cause the Outer Apply exception?

thank you for the help!

alex

3 Answers, 1 is accepted

Sort by
0
Alexandre Jobin
Top achievements
Rank 1
answered on 08 Nov 2010, 07:29 PM
I have debugged the Telerik.Web.Mvc and i've found where i get the "Outer Apply is not supported". Its when you call "result.Total = data.Count();" in the ToGridModel function from the QueryableExtensions.cs

the devArt provider doesnt like the code that is inside the Count() function and i dont know why. If i skip this line, everything seems to work.

Is there a solution for that bug?

alex
0
Alexandre Jobin
Top achievements
Rank 1
answered on 12 Nov 2010, 05:43 PM
Nobody can answer this question?
0
George Witwer
Top achievements
Rank 1
answered on 05 Jan 2011, 07:53 PM
MySQL has the same problem exact as Oracle with OUTER APPLY. The workaround I use with MySQL, is to do the following:

var data = from intervenant inIntervenants
        select new ViewModels.IntervenantGridViewModel()
        {
           IntervenantId = intervenant.IntervenantId,
           Code = intervenant.Code,
           Nom = intervenant.Nom,
           Municipalite = intervenant.Coordonnee.Adresses.FirstOrDefault().Municipalite
        };
 
// ADD THIS LINE:
// convert the data to a list, to force the SQL query to be executed;
// then, convert back to an IQueryable, so ToGridModel() accepts it:
data = data.ToList().AsQueryable();
 
var gridModel = new GridModel<ViewModels.IntervenantGridViewModel>()
{
   Data = data
};
  
return View(gridModel);

This performs well, since you wouldn't be doing further processing with the data anyway (aside from returning it to the grid).
Tags
Grid
Asked by
Alexandre Jobin
Top achievements
Rank 1
Answers by
Alexandre Jobin
Top achievements
Rank 1
George Witwer
Top achievements
Rank 1
Share this question
or