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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:07:49+00:00 2026-05-15T09:07:49+00:00

I’m having a hell of a time getting WCF Data Services to work within

  • 0

I’m having a hell of a time getting WCF Data Services to work within Silverlight. I’m using the VS2010 RC.

I’ve struggled with the cross domain issue requiring the use of clientaccesspolicy.xml & crossdomain.xml files in the web server root folder, but I just couldn’t get this to work. I’ve resorted to putting both the Silverlight Web App & the WCF Data Service in the same project to get past this issue, but any advice here would be good.

But now that I can actually see my data coming from the database and being displayed in a data grid within Silverlight I thought my troubles were over – but no. I can edit the data and the in-memory entity is changing, but when I call BeginSaveChanges (with the appropriate async EndSaveChangescall) I get no errors, but no data updates in the database.

Here’s my WCF Data Services code:

public class MyDataService : DataService<MyEntities>
{
    public static void InitializeService(DataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule("*", EntitySetRights.All);
        config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    }

    protected override void OnStartProcessingRequest(ProcessRequestArgs args)
    {
        base.OnStartProcessingRequest(args);
        HttpContext context = HttpContext.Current;
        HttpCachePolicy c = HttpContext.Current.Response.Cache;
        c.SetCacheability(HttpCacheability.ServerAndPrivate);
        c.SetExpires(HttpContext.Current.Timestamp.AddSeconds(60));
        c.VaryByHeaders["Accept"] = true;
        c.VaryByHeaders["Accept-Charset"] = true;
        c.VaryByHeaders["Accept-Encoding"] = true;
        c.VaryByParams["*"] = true;
    }
}

I’ve pinched the OnStartProcessingRequest code from Scott Hanselman’s article Creating an OData API for StackOverflow including XML and JSON in 30 minutes.

Here’s my code from my Silverlight app:

private MyEntities _wcfDataServicesEntities;
private CollectionViewSource _customersViewSource;
private ObservableCollection<Customer> _customers;

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
    if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
    {
        _wcfDataServicesEntities = new MyEntities(new Uri("http://localhost:7156/MyDataService.svc/"));
        _customersViewSource = this.Resources["customersViewSource"] as CollectionViewSource;
        DataServiceQuery<Customer> query = _wcfDataServicesEntities.Customer;
        query.BeginExecute(result =>
        {
            _customers = new ObservableCollection<Customer>();
            Array.ForEach(query.EndExecute(result).ToArray(), _customers.Add);
            Dispatcher.BeginInvoke(() =>
            {
                _customersViewSource.Source = _customers;
            });
        }, null);
    }
}

private void button1_Click(object sender, RoutedEventArgs e)
{
    _wcfDataServicesEntities.BeginSaveChanges(r =>
    {
        var response = _wcfDataServicesEntities.EndSaveChanges(r);
        string[] results = new[]
        {
            response.BatchStatusCode.ToString(),
            response.IsBatchResponse.ToString()
        };
        _customers[0].FinAssistCompanyName = String.Join("|", results);
    }, null);
}

The response string I get back data binds to my grid OK and shows “-1|False”.

My intent is to get a proof-of-concept working here and then do the appropriate separation of concerns to turn this into a simple line-of-business app.

I’ve spent hours and hours on this. I’m being driven insane. Any ideas how to get this working?

  • 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-15T09:07:50+00:00Added an answer on May 15, 2026 at 9:07 am

    If you want change tracking you need to generate the client side classes with support for it and you need to use DataServiceCollection to store your results. A nice description is here : http://msdn.microsoft.com/en-us/library/ee373844.aspx

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I want to construct a data frame in an Rcpp function, but when I
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

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.