I am trying to Plug Unity into a WCF Service Library with a Service Behavior.
I need a simple bare bones example of a Service Behavior.
All I want to do is setup my IOC Unity Container on startup of the WCF Service.
NOTE: I am not using a WCF Service Application. So I don’t have access to ANY of the ASP.NET ways of doing this. From a concept point of view, a service behavior seems like the most elegant method. But I don’t know how to set one up (what code do I need, were do I update the config files, etc).
If you want to control the instancing of the WCF service instances, you’ll need a service behavior to plug an
IInstanceProviderfor that. You can find a simple provider implementation (for an IoC container) in the post about that interface at http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/31/wcf-extensibility-iinstanceprovider.aspx.Per the comments, if all you need is a simple IServiceBehavior, here’s a sample implementation you can use.