private static int GetColumnId(string uniqueName, ConstantsBase constants, IColumnProvider columnProvider) { if (!string.IsNullOrEmpty(uniqueName)) { var columns = columnProvider.Find(constants.DataSourceId, uniqueName, cacheOnly: false); if (!columns.Any()) { throw new Exception( string.Format( "Error initializing Constants for DataSource Id:{0} ({1}): No column found with UniqueName '{2}'", constants.DataSourceId, constants.Platform, uniqueName)); } if (columns.Count() > 1) { throw new Exception( string.Format( "Error initializing Constants for DataSource Id:{0} ({1}): More than 1 column found with UniqueName '{2}'", constants.DataSourceId, constants.Platform, uniqueName)); } return(columns.Single().Id); } return(-1); }
private void PopulateColumnsInConstants(ConstantsBase constants, IColumnProvider columnProvider) { try { constants.CurrencyColumnId = GetColumnId(constants.CurrencyColumnUniqueName, constants, columnProvider); constants.DateStatColumnId = GetColumnId(constants.DateStatColumnUniqueName, constants, columnProvider); constants.HourStatColumnId = GetColumnId(constants.HourStatColumnUniqueName, constants, columnProvider); constants.TextSearchColumnId = GetColumnId(constants.TextSearchColumnUniqueName, constants, columnProvider); } catch (Exception ex) { // todo : store the exception for later } }
public DefaultCalculatedColumnHelper(IColumnProvider columnProvider, TableMappingsBase tableMappings, ConstantsBase constants, DefaultQueryHelpers queryHelpers) : base(columnProvider, constants.DataSourceId) { _tableMappings = tableMappings; _constants = constants; QueryHelpers = queryHelpers; var statsTable = _tableMappings.GetAllTables().FirstOrDefault(x => x is StatsTableMapping); if (statsTable != null) { _statsTableName = statsTable.KnownTableName; } var transposeTable = tableMappings.GetAllTables().FirstOrDefault(x => x is TransposeStatsTableMapping); if (transposeTable != null) { _transposeStatsTableName = transposeTable.KnownTableName; } }
public DefaultQueryHelpers(IColumnProvider columnProvider, ConstantsBase constants, TableMappingsBase tableMappings) { _columnProvider = columnProvider; _constants = constants; _tableMappings = tableMappings; }