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

Problem function within Query..NotSupportedException

3 Answers 51 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FISCAL
Top achievements
Rank 1
FISCAL asked on 09 Jun 2010, 01:27 PM
Hi,

I am getting a problem on the query below -

  IEnumerable<ClassGridDisplay> displays = (from h in m_dataContext.Extent<FileUpload>()
                                                                   orderby h.HLTFileUploadID descending
                                                                   select new ClassGridDisplay
                                                                   {
                                                                       ID = h.FileUploadID,
                                                                       FileUploadSize = h.FileUploadFilesize,
                                                                       FileUploadStatus = GetCurrentStatus(h.HLTFileUploadID)
                                                                   });

........................
private string GetCurrentStatus(in id)
{
string status = " ";
.......
return status;
}


Any help would be highly appreciated.

Many thanks.

M G

3 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 10 Jun 2010, 12:28 PM
Hi M G,

I am afraid that projecting to class and executing custom methods in a query are both not supported at the moment. So you will have to do postprocessing like this:
var result = (from h in m_dataContext.Extent<FileUpload>()
            orderby h.HLTFileUploadID descending
            select new
            {
                ID = h.FileUploadID,
                FileUploadSize = h.FileUploadFilesize,
                HLTFileUploadID = h.HLTFileUploadID
            });
                                             
IList<ClassGridDisplay> displays = new List<ClassGridDisplay>();
foreach(var x in result)
{
    ClassGridDisplay display = new ClassGridDisplay();
    display.ID = x.ID;
    display.FileUploadSize = x.FileUploadSize;
    display.FileUploadStatus = GetCurrentStatus(x.HLTFileUploadID);
    displays.Add(display);
}
Please excuse us for the inconvenience caused.

All the best,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
FISCAL
Top achievements
Rank 1
answered on 10 Jun 2010, 01:24 PM
Hi Alex,

Thanks for confirmation - would appreciate if you hint me when will we get this feature? We still evaluating your ORM tool for our development.

Cheers,
M G
0
Alexander
Telerik team
answered on 10 Jun 2010, 05:57 PM
Hi M G,

Actually I was a bit wrong. Projecting to a class is supported except the cases when the query contains joins. This is already fixed and should be available in one of the following internal builds.
However, calling methods within a query is not supported and will probably not make it for Q2 either. Most likely we will provide this functionality in a service pack after Q2 2010.

All the best,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Development (API, general questions)
Asked by
FISCAL
Top achievements
Rank 1
Answers by
Alexander
Telerik team
FISCAL
Top achievements
Rank 1
Share this question
or