THIS BLOG IS AIMED AT DELPHI, C#.NET, ASP.NET PROFESSIONALS WHO ARE NEW TO THE COMMUNITY AND LOOKING FOR TIPS AND TRICKS. IT WILL HOPEFULLY SHOW YOU HOW AND WHERE TO GET HELP BUT WILL NOT TELL YOU HOW TO DO YOUR JOB - THAT BIT IS UP TO YOU.
Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts
Friday, December 11, 2009
Thursday, December 10, 2009
Difference between IServiceBehavior and IEndpointBehavior
I believe this could sound silly, but for those who are fairly new to WCF definitely would like know. By looking at the interface names, we can say that one is for extending the "Service" and the other is for extending "Endpoints". We have recently done couple of interesting things in our organization and thought would share this information with you guys.
The ApplyDispatchBehavior method on IServiceBehavior has access to all endpoints and their runtime components and so shouldn't that be enough for wiring up customization? The short answer is yes, but there are subtle differences.
Some usability differences are:
Look at it this way, ServiceBehavior lets you access runtime parameters for all endpoints while EndpointBehavior lets you access runtime components only for that endpoint. So if you have a need to extend functionality that spawns the entire contract (or multiple contracts) then use ServiceBehavior and if you are interested in extending one specific endpoint then use EndpointBehavior.
And of course, the biggest difference is if you want to customize endpoints on client/consumer then the only option is IEndpointBehavior.
The ApplyDispatchBehavior method on IServiceBehavior has access to all endpoints and their runtime components and so shouldn't that be enough for wiring up customization? The short answer is yes, but there are subtle differences.
Some usability differences are:
- ServiceBehavior applies only on a Service while EndpointBehavior applies on both client and service.
- ServiceBehavior can be specified via Attributes/Code/Config file while Endpointbehavior can be specified through Code or Config file.
- ServiceBehavior has access to all ServiceEndpoints dispatch runtime and so could modify all dispatch runtimes while EndpointBehavior gets called with the runtime for that endpoint only.
Look at it this way, ServiceBehavior lets you access runtime parameters for all endpoints while EndpointBehavior lets you access runtime components only for that endpoint. So if you have a need to extend functionality that spawns the entire contract (or multiple contracts) then use ServiceBehavior and if you are interested in extending one specific endpoint then use EndpointBehavior.
And of course, the biggest difference is if you want to customize endpoints on client/consumer then the only option is IEndpointBehavior.
Subscribe to:
Posts (Atom)
