protected ColumnStrategy() { _dataAccessProvider = new DataAccessProviderFactory(Server.ProviderType); _connection = _dataAccessProvider.CreateConnection(Server.ConnectionString); _columns = new ColumnCollection(); _keys = new KeyCollection(); }
public override void Interpret(Context context) { Regex regex = new Regex(InputPattern,RegexOptions.Singleline); MatchCollection matches = regex.Matches(context.Input); foreach(Match match in matches) { string columnOutput = ""; string columnInput = match.Groups["column"].Value; ColumnCollection columns = ((Table)Parameter).Columns; ColumnCollection filteredColumns = new ColumnCollection(); foreach(Column column in columns) { if(IsValidColumn(column,match.Groups["selection"].Value.Trim())) { filteredColumns.Add(column); } } foreach(Column column in filteredColumns) { string columnTemporaryText = columnInput; RunExpressionsReplace(column, filteredColumns, ref columnTemporaryText); columnOutput += columnTemporaryText; } string escapedString = Regex.Escape( match.Value ); context.Output = Regex.Replace(context.Input ,escapedString,columnOutput); context.Input = context.Output; } }