Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7055519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:45:31+00:00 2026-05-28T03:45:31+00:00

I have combined RIA Services with Entity Framework using POCO’s. It’s all worked wonderfully

  • 0

I have combined RIA Services with Entity Framework using POCO’s. It’s all worked wonderfully (way better than LINQ to SQL). The problem that I have is with the following segment of code:

[Query]
public IQueryable<MyEntity> GetMyEntities()
{
    return from myEntity in ObjectContext.MyEntities
           where myEntity.Status != "deleted"
           select new MyEntity
           {
               // Other property assignments...

               SuchAndSuchTime = TimeSpan.FromMinutes(project.SuchAndSuchTime ?? 0.0),

               // Other property assignments...
           };
}

This is an version of my code where the names have been changed to protect the innocent. This compiles find but I get following exception when I run it:

Load operation failed for query ‘GetMyEntities’. LINQ to Entities does
not recognize the method ‘System.TimeSpan FromMinutes(Double)’ method,
and this method cannot be translated into a store expression.

Why can I not do this, and is there a work around?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:45:32+00:00Added an answer on May 28, 2026 at 3:45 am

    The issue here is that the CLR TimeSpan class does not have full canonical mapping in LINQ to Entities. This is what your exception is referring to in the clause ‘…cannot be translated into a store expression…’

    For LINQ scenarios, queries against the Entity Framework involve mapping certain CLR methods to methods on the underlying data source through canonical functions. Any method calls in a LINQ to Entities query that are not explicitly mapped to a canonical function will result in a runtime NotSupportedException exception being thrown.

    Source: MSDN

    TimeSpan is one of those cases.

    There are at least two solutions, and these are…

    1. Use a valid LINQ to SQL (i.e., canonical methods only) statement to obtain the full set of results from the database; and then use LINQ to Objects to filter the results you get back. The LINQ to Objects filter should contain all of the non-canonical methods so that your filtering delivers the intended subset of data.

    2. Evacuate the non-canonical methods to a stored procedure (i.e., translate to straight SQL) and call the stored procedure.

    The third solution would be to try and wrap the non-canonical expressions into a private method in your domain service class. This is what I did before getting to the bottom of this elusive exception.

    A fourth, and more obscure approach, is given here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario I have two WCF Services combined in a single App.Config file. I can't
i'm using Moscow ML combined with CGI. I have a site that calculates simple
I have combined two arrays using array_merge, and now need to sort them alphabetically.
Hi to all, Is there any class which have combined functionality of ScaleGestureDetector and
I am using devbridge jquery autocomplete plugin . I have combined two tables in
I have a Silverlight / WCF RIA Services application that uses EF 4. Currently,
What I want to do is something like this: I have enums with combined
Have anyone successfully managed to setup a combined Java/C++ project for Eclipse? What I
I have a MySQL (5.0) table with 3 rows which are considered a combined
I have a set of options, some orthogonal (can be combined in any combination),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.