Exemple #1
0
        private FastMethodUtility.FastInvokeHandler GetCustomMethod(dynamic repository, string methodName)
        {
            Type repositoryType = repository.GetType();

            FastMethodUtility.FastInvokeHandler method;
            if (_customMethodDic.TryGetValue(repositoryType.FullName + methodName, out method))
            {
                return(method);
            }

            MethodInfo customMethod = repositoryType.GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance);

            method = FastMethodUtility.GetMethodInvoker(customMethod);
            _customMethodDic.AddOrUpdate(repositoryType.FullName + methodName, method, (key, existed) => method);
            return(method);
        }
Exemple #2
0
        private FastMethodUtility.FastInvokeHandler GetRemoveMethod(dynamic repository)
        {
            Type repositoryType = repository.GetType();

            FastMethodUtility.FastInvokeHandler method;
            if (_removeMethodDic.TryGetValue(repositoryType.FullName, out method))
            {
                return(method);
            }

            MethodInfo removeMethod = repositoryType.GetMethod("Remove", BindingFlags.Public | BindingFlags.Instance);

            method = FastMethodUtility.GetMethodInvoker(removeMethod);
            _removeMethodDic.AddOrUpdate(repositoryType.FullName, method, (key, existed) => method);
            return(method);
        }