3

I want to know what is difference between IOperationBehavior and IContractBehavior and what is special case when we can see difference between this two in development.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dotnetstep
  • 17,065
  • 5
  • 54
  • 72
  • 1
    Hmm.... `IContractBehavior` is a behavior that applies to the **whole** contract (**all** operations), while a `IOperationBehavior` can be set on invidiual operations (and left out from others) – marc_s Mar 29 '14 at 12:53
  • 1
    Means IContractBehavior applies to all operation then How it is diffrence from IServiceBehavior. – dotnetstep Mar 29 '14 at 13:10
  • 1
    Same again: the `IServiceBehavior` applies to the **entire** service (**ALL** contracts - and yes, it could be multiple! - that the service class implements!) while the `IContractBehavior` applies only to one, single contract – marc_s Mar 29 '14 at 13:21

1 Answers1

3

A WCF service can has multiple contracts.

  • IServiceBehavior - applies to all contracts and can be applied thru the config file or the attribute
  • IContractBehavior - applies only to one contract and can be applied only thru the attribute
GSerjo
  • 4,725
  • 1
  • 36
  • 55