Problem function within Query..NotSupportedException

4 posts, 0 answers
  1. FISCAL
    FISCAL avatar
    91 posts
    Member since:
    May 2010

    Posted 09 Jun 2010 Link to this post

    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

  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 10 Jun 2010 Link to this post

    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.
  3. DevCraft banner
  4. FISCAL
    FISCAL avatar
    91 posts
    Member since:
    May 2010

    Posted 10 Jun 2010 Link to this post

    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
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 10 Jun 2010 Link to this post

    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.
Back to Top