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 8818953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:13:59+00:00 2026-06-14T05:13:59+00:00

I am working on a ASP.NET MVC 4.5 Application with an WCF back-end where

  • 0

I am working on a ASP.NET MVC 4.5 Application with an WCF back-end where entity framework 5 is used as Data-Access.
PictureUse is the entity, PictureUsageContract is the DataContract that is transmitted through WCF.

The Repository.GetAll is a standard generic get all to get entities out of an Object Context.

var allPictureUses = _pictureUseRepository.GetAll()
                .Where(x => x.Name != null)
                .Include(x => x.PictureUse1)
                .Select(x => new PictureUsageContract()
                {
                    ID = x.ID,
                    DefaultPrice = x.DefaultPrice,
                    Name = x.Name,
                    UseDescription = x.UseDescription,
                    SubItemList = x.PictureUse1.Select(c => c.UseDescription).ToList()        

                }).ToList();

Exception recieved while debugging: {“LINQ to Entities does not recognize the method ‘System.Collections.Generic.List1[System.String] ToList[String](System.Collections.Generic.IEnumerable1[System.String])’ method, and this method cannot be translated into a store expression.”}

I know it is the following line that did it:

  SubItemList = x.PictureUse1.Select(c => c.UseDescription).ToList()  

SubItemList is a List PictureUse is an Entity.

I searched a bit beforehand and know that it might be that .Select isn’t properly supported by LINQ to Entities, but I have not found any concrete solution to this problem.

Any help would be welcome.

  • 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-14T05:14:01+00:00Added an answer on June 14, 2026 at 5:14 am

    If you are getting an error saying that Linq To Entities does not support ToList, then the obvious thing to do is to remove it.

    So I would try

    var allPictureUses = _pictureUseRepository.GetAll()
                .Where(x => x.Name != null)
                .Include(x => x.PictureUse1)
                .Select(x => new PictureUsageContract()
                {
                    ID = x.ID,
                    DefaultPrice = x.DefaultPrice,
                    Name = x.Name,
                    UseDescription = x.UseDescription,
                    SubItemList = x.PictureUse1.Select(c => c.UseDescription)        
    
                }).ToList();
    

    If that does not work, (eg it might not allow you to assign to SubItemList) then you might have to retrieve the details into a list of anonymous objects before converting them to a List

    eg

    var allPictureUses = _pictureUseRepository.GetAll()
                .Where(x => x.Name != null)
                .Include(x => x.PictureUse1)
                .Select(x => new 
                {
                    ID = x.ID,
                    DefaultPrice = x.DefaultPrice,
                    Name = x.Name,
                    UseDescription = x.UseDescription,
                    SubItemList = x.PictureUse1.Select(c => c.UseDescription)        
    
                }).ToList()
    
                .Select(x => new PictureUsageContract()
                {
                    ID = x.ID,
                    DefaultPrice = x.DefaultPrice,
                    Name = x.Name,
                    UseDescription = x.UseDescription,
                    SubItemList = x.SubItemList.ToList()     
    
                }).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've started working with ASP.NET MVC and using Entity Framework, concretely with SQLite db,
I am working on asp.net mvc application using the mvc2 framework. Here is the
I'm working in asp.net mvc 4 with Entity Framework 5 (with edmx). I'm trying
I'm working on an asp.net-mvc application. The linq data context is being passed into
I'm working on an asp.net MVC 3 application which is using Data Models from
I am working on an ASP.NET MVC application where I need to export data
I am working with an ASP.NET MVC application. I have one master page having
I am working on an asp.net MVC 3 application. I have a C# function
I'm currently working on an Asp.net MVC Web application. In my solution, there're two
I'm working in an ASP.NET 3.5 MVC application where i've got a view with

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.