예제 #1
0
        private KeyedRoleMap BeforeFunction(MethodInfo cMethod, Object[] args)
        {
            KeyedRoleMap parent = RoleMapHolder.ROLE_MAPS.Value.Any() ? RoleMapHolder.ROLE_MAPS.Value.Peek() : null;
            KeyedRoleMap map;

            if (!RoleMapHolder.ROLE_MAPS_POOL.TryTake(out map))
            {
                map = new KeyedRoleMap(parent);
            }
            else
            {
                map.Clear(parent);
            }
            Int32 idx = 0;

            foreach (ParameterModel pModel in this._cInstance.MethodToModelMapping[cMethod].Parameters)
            {
                RoleParameterAttribute attr = pModel.AllAttributes.OfType <RoleParameterAttribute>().FirstOrDefault();
                if (attr != null)
                {
                    map.SetWithKey(attr.Name, args[idx]);
                }
                ++idx;
            }
            RoleMapHolder.ROLE_MAPS.Value.Push(map);

            RoleMapHolder.INVOCATION_DATA.Value.FunctionStarted();
            //CompositeHolder.COMPOSITES.Value.AddLast( composite );

            return(map);
        }
예제 #2
0
        //private void AddCustomRoles( MethodInfo methodKey, TKey key, Object[] args, KeyedRoleMap map, TComposite functionComposite )
        //{
        //   Func<TKey, TComposite, Object[], IEnumerable<Tuple<String, Object>>> additionalRoles;
        //   if ( this._info.AdditionalRoles.TryGetValue( methodKey, out additionalRoles ) && additionalRoles != null )
        //   {
        //      foreach ( var role in additionalRoles( key, functionComposite, args ) )
        //      {
        //         map.SetWithKey( role.Item1, role.Item2 );
        //      }
        //   }
        //}

        private void AfterFunction(KeyedRoleMap instance)
        {
            //CompositeHolder.COMPOSITES.Value.RemoveLast();
            RoleMapHolder.ROLE_MAPS.Value.Pop();
            RoleMapHolder.ROLE_MAPS_POOL.Return(instance);

            RoleMapHolder.INVOCATION_DATA.Value.FunctionEnded();
        }
예제 #3
0
 internal InvocationDataHolder()
 {
     this._rolemap = new KeyedRoleMap();
     this._depth   = 0;
 }