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

  • SEARCH
  • Home
  • 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 8487439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:14:24+00:00 2026-06-10T21:14:24+00:00

I want to do something like this: var apps = from app in context.Apps

  • 0

I want to do something like this:

var apps = from app in context.Apps
    where (platform == AppPlatform.All ||
    (app.Platform == sPlatform && new Version(app.PlatformVersion) <= version))&&
    (availability == AppAvailability.All || app.Availability == sAvailability)
    select app;
return apps.ToList();

The line new Version(app.PlatformVersion) <= version)) is causing an error: Only parameterless constructors and initializers are supported in LINQ to Entities.

Basically what I need is to make my entity model parse the app.PlatformVersion as a new Version() object, instead of string, but I apparently can’t do this from within my linq-to-entity. Can I do this at the entity-model level? I have other fields (strings) that I’d like to parse into types as well (like parsing a string to an Enum). How would I accomplish this?

  • 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-06-10T21:14:26+00:00Added an answer on June 10, 2026 at 9:14 pm

    Because EF tries to translate the Linq query to SQL and there is no way to translate Version method. So you could just query with other conditions first and store it in memory, then query from the in-memory object using the complex Linq query.

    Technically you could do this, (you can definitely make it better in terms of the performance)

    var apps_temp = from app in context.Apps.All().ToList();
    
    //this query will not be translated to SQL.
    var apps = from app in apps_temp
        where (platform == AppPlatform.All ||
        (app.Platform == sPlatform && new Version(app.PlatformVersion) <= version))&&
        (availability == AppAvailability.All || app.Availability == sAvailability)
        select app;
    
    
    return apps.ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a two-dimensional array of ArrayBuffer Something like this: var myRowOfStrings = new
I want to do something like this: require 'erb' @var = 'test' template =
I want to do something like $('a.filter-link').click(function(e) { e.preventDefault(); var that = $(this), categoryId
input is a string (var str) something like this: <<hello there//abcd//1234>> I want to
I want to do something like this: var html = $(#media).html(); $(#multimedia-content).append(html); $(#multimedia-content).filter(*).removeAttr(id); The
I want to do something like this: var w = window.open(javascript: makeAnAjaxRequest();); My question
I want to do something like this: var showLi = $(<li></li>); $(showLi).append(<a href='#' class='showData'>Show</a>);
I want to do something like this: var sp = el.getElement('option[value=Option With Spaces]'); ie.
If I do something like this: var a = new List<something>(); var b =
I want to be able to do something like this: var MyObject = function(prop)

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.