WCF Facility contains two contextual lifestyles
If you're using sessionful binding you may want some components to live for the scope of the session. For that you use
You attach the lifestyles using extension method, so you first need to add the following using statement:
Then you can register your component with the lifestyle:
Now the instance of the component will be shared across the lifetime of the WCF session.
If you want to scope component per operation, you use
lifestyle. It works pretty much like
When the component with either of the above lifestyles is being resolved not within Wcf session or Wcf operation, an exception will be thrown.