Ejemplo n.º 1
0
 public override void ReflectMethod()
 {
     object[] ats = ReflectionContext.Method.MethodInfo.GetCustomAttributes(typeof(CompressAttribute), true);
     if (ats.Length > 0)
     {
         CompressAttribute        at        = (CompressAttribute)ats[0];
         CompressOperationBinding opBinding = new CompressOperationBinding();
         opBinding.MinLength = at.MinLength;
         ReflectionContext.OperationBinding.Extensions.Add(opBinding);
     }
 }
Ejemplo n.º 2
0
    public override void ImportMethod(CodeAttributeDeclarationCollection metadata)
    {
        CompressOperationBinding cob = ImportContext.OperationBinding.Extensions.Find(typeof(CompressOperationBinding)) as CompressOperationBinding;

        if (cob == null)
        {
            return;                             // Extension element not present
        }
        CodeAttributeDeclaration att = new CodeAttributeDeclaration("Compress");

        if (cob.MinLength != 0)
        {
            att.Arguments.Add(new CodeAttributeArgument("MinLength", new CodePrimitiveExpression(cob.MinLength)));
        }
        metadata.Add(att);
    }