.net - Should I apply service attributes to the interface, to the concrete class, or to both? -
i implementing .net wcf service , want apply namespace future versioning. coworker mentioned ought apply several attributes both interface , concrete implementation class interface, not clear me 1) if correct, , 2) assuming correct, why important apply attributes in both places.
[servicecontract] [servicebehavior(namespace = constants.namespace1_0)] [webservice(namespace = constants.namespace1_0, name = "myservice1_0")] [webservicebindingattribute(conformsto = system.web.services.wsiprofiles.basicprofile1_1, emitconformanceclaims = true)] public interface imyservice { [operationcontract] [operationcontract(name = "mymethod", action = constants.namespace1_0 + "/imyservice/mymethod")] string mymethod(string phrase); } public class myserviceconcrete : imyservice { public string mymethod(string phrase); } in example, should apply attributes applied interface concrete class (and methods) implements myservice interface? should apply same attributes in both places or 1 of places, , why? thanks.
you need apply service attributes interface. interface, , interface, used wcf define api - implementation implements interface members, attributes not needed there. attributes on concrete implementation ignored.
Comments
Post a Comment