System.ServiceModel 4.0.0.0

Implement the interface to control the creation and recycling of service objects when one is requested or disposed by an object.

Once the interface is implemented, you must assign your custom instance provider object to the property using either an endpoint behavior (a object) or a contract behavior (a object).

If the insertion mechanism is an endpoint behavior you can also implement a object that can insert your custom behavior using a configuration file. If the insertion mechanism is a contract behavior, you can insert the behavior programmatically prior to the opening of the service host or you can implement a custom attribute. (For an example of the contract behavior approach, see the Example section.)

has two methods, and . These methods are typically implemented to create service objects using a non-default constructor or to initialize or dispose of some state related to the lifetime of the object. Service object pooling is one example of custom functionality.

Typically, the invokes the when the is first created and invokes the method when the is closed.

There are two ways to cause an object to release a service object before the is closed. The first method is to set the to or . The second method is to call the method. If this is done, the calls the method on the dispatcher's instance provider. If a new message arrives after the instance has been released, indigo2 creates a new instance using the method.

If the of the service is , the system does not call the or methods even when the user did not provide a well-known service object unless the user directly calls and then calls .

Declares methods that provide a service object or recycle a service object for a indigo1 service.

- Method
  4.0.0.0
  System.Object `` To be added.

  Use the method to control the exact service object that a indigo2 service receives when it attempts to create a new one.

  Returns a service object given the specified object.

  A user-defined service object.

- Method
  4.0.0.0
  System.Object `` `` To be added.

  Use the method to control the exact service object that a indigo2 service receives when it attempts to create a new one.

  Returns a service object given the specified object.

  The service object.

  The message that triggered the creation of a service object.
- Method
  4.0.0.0
  System.Void `` `` To be added.

  Use the method to perform some custom resource disposal or other recycling customization when a service recycles a service object.

  Called when an object recycles a service object.

  The service object to be recycled.