Пример #1
0
        public IHandle <TRes> GetHandle <TRes>(Func <ICursor, RedisValue[], RedisKey[], TRes> action)
            where TRes : RedResult
        {
            var decompilation = _decompiler.Decompile(action);
            var redIL         = _csharpCompiler.Compile(decompilation);

            var handle = _luaHandler.CreateHandle <TRes>(redIL);

            return(handle);
        }
Пример #2
0
        /// <summary>
        /// Accepts a Function delegate and creates a non-initialized handle for executing the function
        /// </summary>
        /// <param name="function">A delegate with the function to execute</param>
        /// <typeparam name="TRes">The return type of the function</typeparam>
        /// <returns>A non-initialized handle for executing the function</returns>
        public IHandle <TRes> GetHandle <TRes>(Function <TCursor, TRes> function)
        {
            var decompilation = DecompilationResult.CreateFromDelegate(_delegateReader, function);
            var redIL         = _csharpCompiler.Compile(decompilation);

            // We create the Lua handle regardless of whether we in Debug or not
            // Because we still want to fail/throw if RedIL/Lua compilation has failed
            var luaHandle = _luaHandler.CreateHandle <TRes>(redIL);

            if (DebuggingEnabled && Debugger.IsAttached && !(DebugInstance is null))
            {
                return(new DebugHandle <TCursor, TRes>(luaHandle, DebugInstance, function));
            }

            return(luaHandle);
        }