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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:46:23+00:00 2026-05-14T00:46:23+00:00

I have a WCF service which performs CRUD operation on my data model: Add,

  • 0

I have a WCF service which performs CRUD operation on my data model: Add, Get, Update and Delete. And I’m using Entity Framework for my data model.
On the other side there is a client application which calls methods of the WCF service.

For example I have a Customer class:

[DataContract]
public class Customer
{
   public Guid CustomerId {get; set;}
   public string CustomerName {get; set;}
}

and WCF service defines this method:

public void AddCustomer(Customer c)
{
    MyEntities _entities = new MyEntities();
    _entities.AddToCustomers(c);
    _entities.SaveChanges();
}

and the client application passes objects to the WCF service:

var customer = new Customer(){CustomerId = Guid.NewGuid, CustomerName="SomeName"};
MyService svc = new MyService();
svc.Add(customer); // or svc.Update(customer) for example

But when I need to pass a great amount of objects to the WCF it could be a perfomance issue because of I need to create ObjectContext each time when I’m doing Add(), Update(), Get() or Delete().

What I’m thinking on is to keep ObjectContext on the client and pass ObjectContext to the wcf methods as additional parameter.

Is it possible to create and keep ObjectContext on the client and don’t recreate it for each operation? If it is not, how could speed up the passing of huge amount of data to the wcf service?

Sergey

  • 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-14T00:46:23+00:00Added an answer on May 14, 2026 at 12:46 am

    No, the ObjectContext can’t be serialised over a WCF service call.

    The current version of the entity framework doesn’t really have any support for n-tier apps like this.

    We have an n-tier app using the entity framework and we detach our objects from the ObjectContext each time and do re-creation and re-attaching for every call and it works fine. There doesn’t seem to be any significant performance cost for doing the recreations (SQL server will be pooling the database connections anyway), so unless you are doing something requiring really heavy throughput then don’t get into premature optimisation. Just get it running, then profile it. To be honest, your biggest bottle neck is going to be the WCF service call and the data transfer over the network anyway, so if you are looking to improve performance, minimise the quantity of data you are transferring instead of worrying about your ObjectContext. Or you could create a service call that takes a list of objects and adds them all at the same time.

    However, EF4 is going to do this better. Take a look at this MSDN article for some more information on n-tier support in EF4. If you work with the beta or wait a month for the release it might be worth taking a look.

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

Sidebar

Related Questions

I have two WCF service applications which pass Data Transfer Objects between each other
I have a Windows Service which performs some data collection from a serial device
I have a WCF Service, hosted inside of IIS, using NHibernate for data access.
I have a WCF service which programmatically creates its endpoints rather than using a
I have a WCF service which accepts a string as a paramter for one
I have a WCF service which works on my dev machine running IIS 7,
I have a WCF service which references a 3rd party DLL. That DLL looks
I have a WCF service which would like to support basicHttpBinding and webHttpBinding. When
I have a WCF service which is connected to an sql server database which
So I have wcf rest service which succesfuly runs from a console app, if

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.