Example #1
0
            /// <summary>
            /// Compile the string expression into a COExpression object.
            /// </summary>
            /// <param name="expression">The expression to compile.</param>
            /// <returns>Compiled COExpression object.</returns>
            public static COExpression <ClassificationObject> Compile <T>(String expression) where T : ClassificationObject
            {
                System.Linq.Expressions.LambdaExpression lambda = DynamicExpression.ParseLambda(typeof(T),
                                                                                                typeof(bool), expression);

                return(ExpressionCasting <T> .ExpressionCast(lambda.Compile()));
            }
        protected override COExpression <ClassificationObject> CreateFilteringExpression(ResourceStaticAnalysisRulesConfig.ValueList cultures, ResourceStaticAnalysisRulesConfig.ValueList projects, List <ResourceStaticAnalysisRulesConfig.FilteringExpression> filteringExpressions)
        {
            // This data structure does not support cultres and projects.
            List <COExpression <ClassificationObject> > filteringMethods = new List <COExpression <ClassificationObject> >();

            COExpression <LocResource> mergedFilter = lr => filteringMethods.TrueForAll(method => method(lr));

            return(ExpressionCasting <LocResource> .ExpressionCast(mergedFilter));
        }