1

Topic: Whether it is possible to change attribute at an interface method?

All greetings! From indirect service the studio  something like the following comes WSDL, from which: public interface IMyInterface {//CODEGEN: Generating message contract since the operation MyMethod is neither RPC nor document wrapped. [System.ServiceModel.OperationContractAttribute (Action = "http://failUrl/request", ReplyAction = "http://failUrl/response")] [System.ServiceModel.XmlSerializerFormatAttribute (SupportFaults=true)] Response MyMethod (Request request); It is absolutely not working variant the Worker such: [System.ServiceModel.OperationContractAttribute (Action = "http://www.service.com/SDFSDF", ReplyAction = "*")] whether It is possible to change values at attribute? If in a design time it does not turn out, then in  As a last resort - in  but while it is not clear in what Thanks...

2

Re: Whether it is possible to change attribute at an interface method?

Perhaps another's   by means of Reflexil? PS Though, probably, my answer neither here nor there because words WSDL and  are unfamiliar to me.

3

Re: Whether it is possible to change attribute at an interface method?

Hello, mDmitriy, you wrote: whether D> It is possible to change values at attribute? At me here that turned out: using System; using System. ComponentModel; using System. Linq; class Program {public class CustomAttribute: Attribute {public string Data {get; set;} public CustomAttribute (string data) => Data = data;} [Custom ("Hello, World!")] public class Foo {} static void Main () {var attr1 = TypeDescriptor. GetAttributes (typeof (Foo)).OfType <CustomAttribute> ().FirstOrDefault (); Console. WriteLine ("before:" + attr1.Data); TypeDescriptor. AddAttributes (typeof (Foo), new CustomAttribute ("Oops!")); foreach (var attr2 in TypeDescriptor. GetAttributes (typeof (Foo)).OfType <CustomAttribute> ()) {Console. WriteLine ("after:" + attr2.Data);} }} Result: before: Hello, World! after: Oops! If I correctly understood, TypeDescriptor is not able to work with several copies of one attribute, and is visible therefore at adding of new attribute old same the automatic machine is killed. PS though this piece, apparently, can work only with attributes of types and properties, not with methods.

4

Re: Whether it is possible to change attribute at an interface method?

Hello, alexzzzz, you wrote: A> Result: A> before: Hello, World! A> after: Oops! It at all that, unfortunately... I should change not attribute at a class, and attribute at a method of the interface And that changeover went the automatic machine at least in  without an explicit call of a replacing method

5

Re: Whether it is possible to change attribute at an interface method?

Hello, mDmitriy, you wrote: D> All greetings! Whether D> it is possible to change values at attribute? And that hinders to download wsdl, in it to change. And only after that  the interface?

6

Re: Whether it is possible to change attribute at an interface method?

Hello, mDmitriy, you wrote: whether D> It is possible to change values at attribute? D> if in a design time it does not turn out, then in  And why it does not turn out in Design Time? You after all use standard Service Reference? Then it is possible to implement IOperationContractGenerationExtension There only one method which is caused for each generated operation. To you comes OperationContractGenerationContext in which to you property SyncMethod (if not to consider asynchronous operations) is required. It anything other as the class from CodeDOM (CodeTypeMember) at which is property CustomAttributes I.e. write the extension which will receive all generated methods, to look them , to find "defective" and to correct. It will be necessary to specify the extension in a project config for which do generation Service References. P.S. Forgive, now to unwinding an example I will not make, simply already it is necessary to run. But if it will be necessary, I can try to represent.

7

Re: Whether it is possible to change attribute at an interface method?