This project is read-only.
ServiceModel.Composition provides basic functionality to deal with services with InstanceContextMode.PerSession behavior. You need to set UsePerServiceInstancing of ExportService attribute to true. Then mark all dependencies used in session context by PerServiceInstance attribute.

[ExportService(UsePerServiceInstancing = true)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class SampleService : ISampleService

public class Dependency : IDependecy

Using per service instance mode will create new child composition container for each new service instance. The child catalog use parts filtered from parent container's catalog. You can partially access the child conainer (or THE container, if not using per service instance mode.

var compositionExtension = 

For dealing with more complicated scenarios, you will need to provide your own composition container using CompositionScopeDefinition for Windows Process Activation Service (WAS) or Self-Hosted Service Application.


Last edited Jan 14, 2014 at 8:34 PM by kovalikp, version 6