public override void ReflectMethod() { ProtocolReflector reflector = ReflectionContext; YMLAttribute attr = (YMLAttribute)reflector.Method.GetCustomAttribute( typeof(YMLAttribute)); // If the YMLAttribute has been applied to this XML Web service // method, add the XML defined in the YMLOperationBinding class. if (attr != null) { YMLOperationBinding yml = new YMLOperationBinding(); yml.Reverse = !(attr.Disabled); reflector.OperationBinding.Extensions.Add(yml); } }
public override void ImportMethod( CodeAttributeDeclarationCollection metadata) { SoapProtocolImporter importer = ImportContext; // Check whether the XML specified in the YMLOperationBinding // is in the service description. YMLOperationBinding yml = (YMLOperationBinding)importer.OperationBinding.Extensions.Find( typeof(YMLOperationBinding)); if (yml != null) { // Only apply the YMLAttribute to the method when the XML should // be reversed. if (yml.Reverse) { CodeAttributeDeclaration attr = new CodeAttributeDeclaration(typeof(YMLAttribute).FullName); attr.Arguments.Add( new CodeAttributeArgument(new CodePrimitiveExpression(true))); metadata.Add(attr); } } }