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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:34:25+00:00 2026-05-12T15:34:25+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.

Scenario

I have a server-side method in my DomainServiceClass that returns an IEnumerable list of objects.
In my ApplicationName.Web.g.cs file I have an autogenerated function too.
In my Silverlight Client Application I want to be able to run a foreach loop over the returned list of objects.

DomainServiceClass Method:

    public IEnumerable<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

             select new Image
             {
                 HighResUrl = i.HighResUrl,
                 LowResUrl = i.LowResUrl,
                 UploadDate = i.UploadDate
                 }).AsEnumerable();

        return query;
    }

ApplicationName.Web.g.cs AutoGenerated Function:

    /// <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);
    }

Silverlight Client Invocation Code:

var context = dds.DomainContext as InmZenDomainContext;
                foreach(var item in context.GetJobImagesQuery(currentJob.JobID.ToString())
                {
                   item.etc.....//
                }

Problem

Unfortunately When I try and invoke this method as above, I receive either the error:

‘Cannot implicitly convert type System.Windows.Ria.Data.EntityQuery to System.Collections.IEnumerable’.

OR

‘Does not contain a public definition for GetEnumerator’.

After reading and talking to others, I have been informed that I need to change the return type on the AutoGenerated Function (I think).

Question

Does anyone know of a way in which I can change the return type to IEnumerable on this AutoGenerated EntityQuery?! – Or of a different way in which to solve this problem?

Attempted the following:

    /// <summary>
    /// Returns an EntityQuery for query operation 'GetJobImages'.
    /// </summary>
    public IEnumerable<Image> GetJobImagesQuery(string jobGuid)
    {
        Dictionary<string, object> parameters = new Dictionary<string, object>();
        parameters.Add("jobGuid", jobGuid);
        return base.CreateQuery<Image>("GetJobImages", parameters, false, true);
    }

(This fails since the method is autogenerated, it just springs back to what it used to be when I build the solution.)

Help greatly appreciated.

  • 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:34:25+00:00Added an answer on May 12, 2026 at 3:34 pm

    The problem is that you’re missing a step between your call and the IEnumerable collection.

    You need to execute the EntityQuery and use LoadOperation to get your results. It’s not as straightforward as you’d think, and here’s a good forum post that has an example of how to handle things:

    How to get a List<> from LoadOperation

    Here’s the relevant line from the example:

    EntityQuery query = Context.GetEmployeesQuery();
    
    Context.Load<Employee>(query).Completed += (sender, args) => {
        List<Employee> list = ((LoadOperation<Employee>)sender).Entities.ToList();
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Currently I have a C# Silverlight business application which uses RIA Services. The
Background : I currently have a Web Forms, ASP.NET 3.5/C# application which I'm interested
Some background. Currently have an asp.net web site which is contained on 2 web
I have an asp.net application with a background thread. The thread starts when the
I currently have a silverlight app designed mainly in expression blend, using a border
I'm currently trying out Silverlight with RIA Services. I'm implementing a simple login form.
I have a Silverlight application that is using a navigation frame. I am trying
I currently have an application which takes a screenshot of a presenter's desktop and
I currently have background music playing in my application. in: -(void)viewDidLoad I start the
Background : I am currently using custom controls within my C# project (basic controls

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.