server side currently not implemented

2 posts, 0 answers
  1. luke johnson
    luke johnson avatar
    1 posts
    Member since:
    Sep 2009

    Posted 14 Dec 2010 Link to this post

    I am running OpenAccess Q3 2010 and am running into this error.  I had it working with SQL to Linq and then with Entity Framework.  Is there a work around for something like this with OpenAccess?

    using (CollectionsContext db = new CollectionsContext())
                {
                    IQueryable<LossSaver> query = db.LossSavers;
                    if (reportDate.Equals(DateTime.MinValue))
                    {
                        query = query.Where(q => q.Status == theStatus)
                            .OrderBy(q => q.MemberNumber);
                    }
                    else
                    {
                        query = query.Where(q => q.Status == theStatus)
                             .Where(q => q.ReportDate.Value.Month == reportDate.Month)
                             .Where(q => q.ReportDate.Value.Year == reportDate.Year)
                             .OrderBy(q => q.MemberNumber);
                    }
                    return query.Select(q => Mapper.ToBusinessObject(q)).ToList();
                }

    This is the code.  It is running the code underneath the if part of the statement.

    This is the error:
    An exception occured during the execution of '
    Extent<DataObjects.LossSaver>.Where(q => (q.Status = value(DataObjects.LossSaverDao+<>c__DisplayClass0).theStatus)).OrderBy(q => q.MemberNumber).Select(q => ToBusinessObject(q))'. See InnerException for more details.
    An exception occured during the execution of '
    Extent<DataObjects.LossSaver>.Where(q => (q.Status = value(DataObjects.LossSaverDao+<>c__DisplayClass0).theStatus)).OrderBy(q => q.MemberNumber).Select(q => ToBusinessObject(q))'. See InnerException for more details.

    An exception occured during the execution of '
    Extent<DataObjects.LossSaver>.Where(q => (q.Status = value(DataObjects.LossSaverDao+<>c__DisplayClass0).theStatus)).OrderBy(q => q.MemberNumber).Select(q => ToBusinessObject(q))'. See InnerException for more details.
    An exception occured during the execution of '
    Extent<DataObjects.LossSaver>.Where(q => (q.Status = value(DataObjects.LossSaverDao+<>c__DisplayClass0).theStatus)).OrderBy(q => q.MemberNumber).Select(q => ToBusinessObject(q))'. See InnerException for more details.
    Here is the inner exception:  
    "Execution of 'DataObjects.EntityMapper.Mapper:ToBusinessObject(LossSaver)' on the database server side currently not implemented."

    The method ToBusinessObject accepts a CollectionsContext.LossSavers.LossSaver object and creates a data model class, just a conversion method.  Maybe I just need to think about the error and understand what it is saying but I wanted to get this out here in case someone can point out what is happening.

  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 16 Dec 2010 Link to this post

    Hi luke johnson,

    As the exception message correctly states we still do not support projections of custom objects in our LINQ implementation. However, we support projections of anonymous types. There is an alternative which you can use for your query. The solution for you here should be to call the ToList() method of the query before executing the final select where you assemble your custom objects. In other words you can write the following code:
    return query.ToList().Select(q => Mapper.ToBusinessObject(q));
    This way, you will retrieve the persistent objects in memory and subsequent projections will work with them without troubles. We hope the information provided will help you resolve your issue.

    Contact us back, should you encounter further difficulties.

    All the best,
    Petko_I
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  3. DevCraft banner
Back to Top