how to use both custom handler and ValidationCallHandler in the same method?

Topics: Building and extending application blocks, Enterprise Library Core, General discussion, Policy Injection Application Block, Validation Application Block
May 31, 2011 at 4:57 AM

 For example,I want  to use customCallHandler and ValidationCallHandler  in the Deposit method,

and I instance the BankAccount by the following code ,but it always throw exception,so I want to know how to instance the class?

thank you!

 

      IUnityContainer container =container.AddNewExtension<Interception>();
         container.RegisterType<BusinessLogic.BankAccount>(
           new InterceptionBehavior<PolicyInjectionBehavior>(),
           new Interceptor<TransparentProxyInterceptor>());

      bankAccount = container.Resolve<BusinessLogic.BankAccount>();

 

public sealed class BankAccount : MarshalByRefObject
    {
 
        [customCallHandler("interception1")]
        [ValidationCallHandler()]
        public void Deposit([RangeValidator(typeof(Decimal), "0.0",
                     RangeBoundaryType.Exclusive, "0.0",
                     RangeBoundaryType.Ignore)] decimal depositAmount)
        {
            balance += depositAmount;
        }
            
    }

May 31, 2011 at 5:00 AM

by the way,I use the enterprises libarary 5.0 and unity 2.0

May 31, 2011 at 9:10 AM

I've already answered in the same topic in the Unity Forum - http://unity.codeplex.com/discussions/259583. HTH

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com