O'Reilly logo

Professional WCF 4: Windows Communication Foundation with .NET 4 by Johann Grabner, Fabio Cozzolino, Kurt Claeys, Pablo Cibraro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Instancing

WHAT'S IN THIS CHAPTER?

  • Using different InstanceContextModes

  • Explaining sessions

  • Defining ConcurrencyModes

  • Controlling the Service Life time

  • Using Throttling

  • Introducing Best Practices

  • Implementing throttling

Your proxy on the client side (typically derived from ClientBase<T>) communicates with objects on the server side via the so-called channel stack. The service host accommodates these objects on the server side. As you will have learned in previous chapters, SOAP messages are exchanged between the proxy and the object on the server side. The InstanceContextMode determines whether the client proxy now communicates with one and the same instance of the server object during a session (PerSession), or whether a new instance is created every time the server object is used (PerCall) and is then deleted again as soon as the method call is ended, or whether, last but not least, only one single server instance is created (Single), irrespective of the number of clients.

There is an assumption in classical object-oriented applications that an instance of a class is created and used for work or communication for a certain length of time. If certain properties are set for the object beforehand, they remain in place while there is a valid reference to the object, and the methods which are called up can work with the values which are set beforehand. If the Dispose method is called and the object reference is set to null, important resources are released, and the object can be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required