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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:42:08+00:00 2026-05-27T01:42:08+00:00

I am using EF4/RIA combo in a Silverlight application. I have multiple service methods

  • 0

I am using EF4/RIA combo in a Silverlight application.

I have multiple service methods in my DomainService.

One of the methods fetches some data from the database and then modifies the objects’ values:

IEnumerable<Factor> GetModifiedFactors(double threshold)
{
    List<Factor> factors = ObjectContext.Where(f => f.Id == selectedId).ToList();

    for(int i = 1; i < factors.Count; i++)
    {
        Factor current = factors[i];
        Factor previous = factors[i - 1];

        // Note that here the value of the entity object has been changed
        current.Value = 2 * current.Value - 3 * previous.Value;
    }

    return factors.Where(f => f.Value > threshold);
}

These calculated values are then returned to the SL application.

Note in this example that the entity object’s value has been changed.

I have another service method that changes some data and then calls .SaveChanges().

[Invoke]
public void ResetFactor(int factorId, double defaultValue)
{
    Factor factor = ObjectContext.Factors.FirstOrDefault(f => f.Id == factorId);

    if(factor == null)
        return;

    factor.Value = defaultValue;

    ObjectContext.SaveChanges();
}

Question:

What I want to know is whether this call to SaveChanges in the second service method will affect changes made in the call to the first service method?

Or does every RIA query/service-call create a new EF ObjectContext?

  • 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-27T01:42:08+00:00Added an answer on May 27, 2026 at 1:42 am

    By default, yes, every RIA Domain Service is created, initialized and then it executes your request.

    So new ObjectContext will anyway fetch objects directly from database, so it will contain changes made by other service.

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

Sidebar

Related Questions

I have a database which is created using EF4.1 code first. The data context
In a Silverlight 4 proj i'm using WCF RIA services, MVVM principles and EF
I am using EF4 and I have a situation where I need to insert
New to Entity Framework .Using EF4. I have found articles and managed to use
I am using EF4 CPT4 Code first and I have setup my ObjectContext to
I'm using EF4 with POCO objects the 2 tables are as follows Service ServiceID,
Using EF4 Codefirst RC and MVC .NET I have a Strongly typed view I
I am using EF4.1, have upgraded my project, generated POCO classes to use DbContext
I'm using EF4.1 POCO. I have two tables [Table(Parent)] public class Parent { public
I am using EF4 in VS2010 and I have the following code: MyEntity entity

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.