Ejemplo n.º 1
0
        public void Intercept(Invocation methodInvoke)
        {
            AuthorityAttribute d = methodInvoke.MethodMetaData.GetCustomAttr<AuthorityAttribute>();
            if (d == null) {
                methodInvoke.Invoke();
                return;
            }

            methodInvoke.SystemErrors.Add(new RspError(SystemError.NoPermission));
        }
Ejemplo n.º 2
0
 public void Intercept(Invocation methodInvoke)
 {
     IList<ServiceMethodParam> paramList = methodInvoke.MethodMetaData.Params;
     int index = 0;
     foreach (ServiceMethodParam param in paramList) {
         if (param.TypeCategory == TypeCategory.EntityType) {
             object retValue = methodInvoke.ParamValues[index].TarValue;
             InvalidValue[] msgs = NHVHelper.Instance.Validate(retValue);
             //if (!NHVHelper.Instance.IsValid(retValue)) {
             if (msgs.Length > 0) {
                 foreach (InvalidValue iv in msgs) {
                     methodInvoke.SystemErrors.Add(
                         new RspError(iv.PropertyName, iv.Message));
                 }
                 return;
             }
         }
         index++;
     }
     methodInvoke.Invoke();
 }