Exemple #1
0
 public static object CalculateLambdaExpression(ColumnExpression expression, Type dataType, Type[] servicePredefinedTypes, DataRow dataRow, DataRow inputRow)
 {
     if (!ExpressionCalculator.IsCacheValid(expression, dataRow, inputRow))
     {
         expression.CachedDelegate = new CachedDelegate
         {
             TemplateDataRow  = ((dataRow != null) ? dataRow.Table.Clone().NewRow() : null),
             TemplateInputRow = ((inputRow != null) ? inputRow.Table.Clone().NewRow() : null)
         };
         expression.CachedDelegate.CompiledDelegate = ExpressionCalculator.CompileLambdaExpression(expression, dataType, servicePredefinedTypes, expression.CachedDelegate.TemplateDataRow, expression.CachedDelegate.TemplateInputRow);
     }
     if (expression.CachedDelegate.TemplateDataRow != null)
     {
         expression.CachedDelegate.TemplateDataRow.ItemArray = dataRow.ItemArray;
     }
     if (expression.CachedDelegate.TemplateInputRow != null)
     {
         expression.CachedDelegate.TemplateInputRow.ItemArray = inputRow.ItemArray;
     }
     return(expression.CachedDelegate.CompiledDelegate.DynamicInvoke(expression.DependentColumns.ToArray()));
 }
Exemple #2
0
 public static object CalculateLambdaExpression(ColumnExpression expression, Type dataType, DataRow dataRow, DataRow inputRow)
 {
     return(ExpressionCalculator.CalculateLambdaExpression(expression, dataType, null, dataRow, inputRow));
 }
Exemple #3
0
        private IList <KeyValuePair <string, object> > CalculateCore(DataRow dataRow, DataRow inputRow, IList <ColumnExpression> query)
        {
            List <KeyValuePair <string, object> > list = new List <KeyValuePair <string, object> >();

            foreach (ColumnExpression columnExpression in query)
            {
                list.Add(new KeyValuePair <string, object>(columnExpression.ResultColumn, ExpressionCalculator.CalculateLambdaExpression(columnExpression, this.GetColumnRealDataType(dataRow.Table.Columns[columnExpression.ResultColumn]), dataRow, inputRow)));
            }
            return(list);
        }
Exemple #4
0
 public static ExpressionCalculator Parse(DataTable table)
 {
     return(ExpressionCalculator.Parse(table, "LambdaExpression"));
 }
Exemple #5
0
 internal static Delegate CompileLambdaExpression(ColumnExpression expression, Type dataType, DataRow dataRow, DataRow inputRow)
 {
     return(ExpressionCalculator.CompileLambdaExpression(expression, dataType, null, dataRow, inputRow));
 }