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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:05:29+00:00 2026-05-12T15:05:29+00:00

Background Currently I have a C# Silverlight business application which uses RIA Services. The

  • 0

Background

Currently I have a C# Silverlight business application which uses RIA Services. The application is hosted in ASP.NET using the ADO.NET Entity Framework and a domain service class to read and write to the SQL Server database.

Since the RIA class doesn’t support multiple JOINs between tables, it was therefore necessary to implement LINQ as part of the domain service to JOIN all the tables together and return results.

Problem

I get the error message when I try and use a foreach loop on a returned list of objects:

Does not contain a public definition for GetEnumerator

What are my options for getting data out of this method?

Most of the time I only need one object, so I could just modify the method to select the first result and return a single object.

This method exists in the Domain Service Class. This method defines the context and then calls the method in the Silverlight client.

Method Invocation from Silverlight Client

var context = dds.DomainContext as InmZenDomainContext;
context.GetJobImagesQuery(imageJob.JobID.ToString())

Server Side Linq Query Method (Exists within Domain Service Class)

public List<Image> GetJobImages(string jobGuid)
{
    var query =
        (
            from j in Context.Job
            orderby (j.ShortCode)
            where j.JobID.Equals(jobGuid)
            join a in Context.Audit //.Distinct()
            on j.JobID equals a.Job.JobID
            join i in Context.Image
            on a.Image.JobID equals i.JobID
            //join s in Context.States
            //on z.States.StateID equals s.StateID
            select new Image
            {
                //ShortCode = j.ShortCode,
                HighResUrl = i.HighResUrl,
                LowResUrl = i.LowResUrl,
                UploadDate = i.UploadDate
            }
        ).ToList();
    return query;
}

Invocation method

var context = dds.DomainContext as InmZenDomainContext;
foreach (var item in context.GetJobImagesQuery(imageJob.JobID.ToString()))
{

}

GetJobImagesQuery Declaration (Exists within the generated code file – .Web.g.cs):

/// <summary>
/// Returns an EntityQuery for query operation 'GetJobImages'.
/// </summary>
public EntityQuery<Image> GetJobImagesQuery(string jobGuid)
{
    Dictionary<string, object> parameters = new Dictionary<string, object>();
    parameters.Add("jobGuid", jobGuid);
    return base.CreateQuery<Image>("GetJobImages", parameters, false, true);
}
  • 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-12T15:05:29+00:00Added an answer on May 12, 2026 at 3:05 pm

    GetJobImagesQuery is a method that is generated because of the GetJobImages function. Your method is not supposed to return a List of Images but an IQueryable list of Entity Objects.

    For example:

    public IQueryable<TableName> GetTableByID(long otherTable_ID)
    {
        return this.Context.TableName.Where((x) => x.otherTable_ID == otherTable_ID);
    }
    

    would be generated into:

    public EntityQuery<TableName> GetTableNameByRx_IDQuery(long otherTable_ID)
    {
        Dictionary<string, object> parameters = new Dictionary<string, object>();
        parameters.Add("otherTable_ID", otherTable_ID);
        return base.CreateQuery<TableName>("GetTableNameByotherTable_ID", parameters, false, true);
    }
    

    I think that if you change the return type of GetJobImages to an IQueryable of type “Image” you could grab the Images with a foreach.

    public List<Image> GetJobImages(string jobGuid)
    

    would become:

    public IQueryable<Image> GetJobImages(string jobGuid)
    

    then your code:

    foreach (var item in context.GetJobImagesQuery(imageJob.JobID.ToString()))
    

    would work.

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

Sidebar

Ask A Question

Stats

  • Questions 233k
  • Answers 234k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Considering a typical web-project with a couple of images and… May 13, 2026 at 5:52 am
  • Editorial Team
    Editorial Team added an answer There were a few answers on this question that got… May 13, 2026 at 5:52 am
  • Editorial Team
    Editorial Team added an answer In your application, create an 'admin.py', where you actually register… May 13, 2026 at 5:52 am

Related Questions

I am using VSTS 2008 with C# to develop Silverlight application embedded in web
I have a C# database layer that with static read method that is called
I'm confused about NSUserDefaults on the iPhone. I come from a C / asm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.