Ejemplo n.º 1
0
        public Action <ScriptScopeContext, object, object> GetAssignExpression(Type targetType, ReadOnlyMemory <char> expression)
        {
            if (targetType == null)
            {
                throw new ArgumentNullException(nameof(targetType));
            }
            if (expression.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException(nameof(expression));
            }

            var key = targetType.FullName + ':' + expression;

            if (AssignExpressionCache.TryGetValue(key, out var fn))
            {
                return(fn);
            }

            AssignExpressionCache[key] = fn = SharpPageUtils.CompileAssign(targetType, expression);

            return(fn);
        }
Ejemplo n.º 2
0
        public Action <TemplateScopeContext, object, object> GetAssignExpression(Type targetType, StringSegment expression)
        {
            if (targetType == null)
            {
                throw new ArgumentNullException(nameof(targetType));
            }
            if (expression.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException(nameof(expression));
            }

            var key = targetType.FullName + ':' + expression;

            if (AssignExpressionCache.TryGetValue(key, out var fn))
            {
                return(fn);
            }

            AssignExpressionCache[key] = fn = TemplatePageUtils.CompileAssign(targetType, expression);

            return(fn);
        }