This repository was archived by the owner on Jul 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/Stats.ImportAzureCdnStatistics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ namespace Stats.ImportAzureCdnStatistics
1010{
1111 internal class DataImporter
1212 {
13+ public enum Table
14+ {
15+ Fact_Dist_Download ,
16+ Fact_Download
17+ }
18+
1319 private readonly Func < Task < SqlConnection > > _openStatisticsSqlConnectionAsync ;
1420 private const string _sqlSelectTop1FromTable = "SELECT TOP 1 * FROM [dbo].[{0}]" ;
1521
@@ -18,8 +24,9 @@ public DataImporter(Func<Task<SqlConnection>> openStatisticsSqlConnectionAsync)
1824 _openStatisticsSqlConnectionAsync = openStatisticsSqlConnectionAsync ;
1925 }
2026
21- public async Task < DataTable > GetDataTableAsync ( string tableName )
27+ public async Task < DataTable > GetDataTableAsync ( Table table )
2228 {
29+ var tableName = table . ToString ( ) ;
2330 var dataTable = new DataTable ( ) ;
2431 var query = string . Format ( _sqlSelectTop1FromTable , tableName ) ;
2532
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ public async Task<DataTable> CreateAsync(IReadOnlyCollection<PackageStatistics>
126126
127127 // create facts data rows by linking source data with dimensions
128128 var dataImporter = new DataImporter ( _openStatisticsSqlConnectionAsync ) ;
129- var factsDataTable = await dataImporter . GetDataTableAsync ( " Fact_Download" ) ;
129+ var factsDataTable = await dataImporter . GetDataTableAsync ( DataImporter . Table . Fact_Download ) ;
130130
131131 var knownOperationsAvailable = operations . Any ( ) ;
132132 var knownClientsAvailable = clients . Any ( ) ;
@@ -247,7 +247,7 @@ public async Task<DataTable> CreateAsync(IReadOnlyCollection<ToolStatistics> sou
247247
248248 // create facts data rows by linking source data with dimensions
249249 var dataImporter = new DataImporter ( _openStatisticsSqlConnectionAsync ) ;
250- var dataTable = await dataImporter . GetDataTableAsync ( " Fact_Dist_Download" ) ;
250+ var dataTable = await dataImporter . GetDataTableAsync ( DataImporter . Table . Fact_Dist_Download ) ;
251251
252252 var knownClientsAvailable = clients . Any ( ) ;
253253 var knownPlatformsAvailable = platforms . Any ( ) ;
You can’t perform that action at this time.
0 commit comments