Beispiel #1
0
        public FunctionAggregatorDeclaration <TKey, TComposite> MapServiceMethodToFunctionMethod(
            System.Reflection.MethodInfo serviceMethod,
            System.Reflection.MethodInfo functionMethod,
            Func <Object[], IEnumerable <TKey> > functionLookup,
            Func <Object[], Object[]> preArgTransformer,
            Action <Object[], Object[]> postArgProcessor,
            Func <Application, IEnumerable <TKey>, IEnumerable <KeyValuePair <TKey, Lazy <TComposite> > >, Object[], Tuple <TKey, TComposite, Boolean> > funcWhenDirectLookupFails
            //Func<TKey, TComposite, Object[], IEnumerable<Tuple<String, Object>>> additionalRolesFunc
            )
        {
            ArgumentValidator.ValidateNotNull("Service method", serviceMethod);
            ArgumentValidator.ValidateNotNull("Function method", functionMethod);
            ArgumentValidator.ValidateNotNull("Function lookup", functionLookup);

            var assemblyDeclaration = this._assemblyDeclaration;

            if (preArgTransformer == null)
            {
                preArgTransformer = NO_ARGS_TRANSFORM;
            }
            if (postArgProcessor == null)
            {
                postArgProcessor = NO_POST_ARG_TRANSFORMER_ACTION;
            }

            if (serviceMethod.IsGenericMethod && !serviceMethod.IsGenericMethodDefinition)
            {
                serviceMethod = serviceMethod.GetGenericMethodDefinition();
            }

            //         var keyType = typeof( TKey );
            //         var functionType = typeof( TComposite );

            // TODO check that method generic args match between service and function method
            assemblyDeclaration.WithMixins(typeof(FunctionServiceRegisterMixin <TKey, TComposite>));
            assemblyDeclaration
            .WithMixins(typeof(FunctionServiceMixin <TKey, TComposite>))
            .ApplyWith(new AppliesToFilterFromFunction((cMethod, fMethod) => serviceMethod.Equals(cMethod)));         // Add mixin for function method

            var info = this.GetInfo();

            info.FunctionMethods[serviceMethod]      = functionMethod;
            info.ArgsPreTransformers[serviceMethod]  = preArgTransformer;
            info.ArgsPostTransformers[serviceMethod] = postArgProcessor;
            info.LookupFuncs[serviceMethod]          = functionLookup;
            //if ( additionalRolesFunc != null )
            //{
            //   info.AdditionalRoles[serviceMethod] = additionalRolesFunc;
            //}
            if (funcWhenDirectLookupFails != null)
            {
                info.DirectLookupFailFuncs[serviceMethod] = funcWhenDirectLookupFails;
            }

            return(this);
        }
Beispiel #2
0
 public override bool Equals(object o1)
 {
     if (this == o1)
     {
         return(true);
     }
     if (o1 == null || GetType() != o1.GetType())
     {
         return(false);
     }
     Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback that = (Net.Vpc.Upa.Impl.Config.Callback.DefaultCallback)o1;
     if (converter != null ? !converter.Equals(that.converter) : that.converter != null)
     {
         return(false);
     }
     if (instance != null ? !instance.Equals(that.instance) : that.instance != null)
     {
         return(false);
     }
     return(!(method != null ? !method.Equals(that.method) : that.method != null));
 }
        static int _m_Equals(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Reflection.MethodInfo gen_to_be_invoked = (System.Reflection.MethodInfo)translator.FastGetCSObj(L, 1);



                {
                    object _obj = translator.GetObject(L, 2, typeof(object));

                    bool gen_ret = gen_to_be_invoked.Equals(_obj);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }