Skip to content

Commit 3049bd8

Browse files
Refactor to fix Dax.Model.Extractor namespace (#120)
1 parent dc1faf8 commit 3049bd8

File tree

9 files changed

+25
-27
lines changed

9 files changed

+25
-27
lines changed

src/Dax.Model.Extractor.Tests/DaxModelFixture.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace Dax.Model.Extractor.Tests
22
{
3-
using Dax.Metadata.Extractor;
43
using Microsoft.AnalysisServices;
54
using System.IO;
65
using TOM = Microsoft.AnalysisServices.Tabular;

src/Dax.Model.Extractor.Tests/DaxModelTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace Dax.Model.Extractor.Tests
22
{
3-
using Dax.Metadata.Extractor;
43
using Microsoft.AnalysisServices;
54
using System.Linq;
65
using Xunit;

src/Dax.Model.Extractor.Tests/TomExtractorTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace Dax.Model.Extractor.Tests
22
{
3-
using Dax.Metadata.Extractor;
43
using Microsoft.AnalysisServices;
54
using System;
65
using Xunit;

src/Dax.Model.Extractor/Data/IDbConnectionExtensions.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Dax.Metadata.Extractor;
2-
using Microsoft.AnalysisServices.AdomdClient;
1+
using Microsoft.AnalysisServices.AdomdClient;
32
using System.Data;
43
using System.Data.OleDb;
54

src/Dax.Model.Extractor/DmvExtractor.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
using Dax.Model.Extractor.Data;
2-
using Microsoft.AnalysisServices;
3-
using Microsoft.AnalysisServices.AdomdClient;
1+
using Dax.Metadata;
2+
using Dax.Model.Extractor.Data;
43
using System;
54
using System.Collections.Generic;
65
using System.Data;
76
using System.Diagnostics;
87
using System.Linq;
98
using Tom = Microsoft.AnalysisServices.Tabular;
109

11-
namespace Dax.Metadata.Extractor
10+
namespace Dax.Model.Extractor
1211
{
1312

1413
public class ExtractorException : Exception
@@ -67,7 +66,7 @@ public DmvExtractor(Dax.Metadata.Model daxModel, IDbConnection connection, strin
6766

6867
public static void PopulateFromDmv(Dax.Metadata.Model daxModel, IDbConnection connection, string serverName, string databaseName, string extractorApp, string extractorVersion)
6968
{
70-
Dax.Metadata.Extractor.DmvExtractor de = new Dax.Metadata.Extractor.DmvExtractor(daxModel, connection, serverName, databaseName, extractorApp, extractorVersion);
69+
var de = new DmvExtractor(daxModel, connection, serverName, databaseName, extractorApp, extractorVersion);
7170
de.PopulateModel();
7271
de.PopulateTables();
7372
de.PopulatePartitions();
@@ -1099,12 +1098,12 @@ SELECT DISTINCT
10991098
}
11001099
}
11011100
}
1102-
catch (AdomdErrorResponseException ex)
1101+
catch (Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException ex)
11031102
{
11041103
// We ignore errors accessing this DMV
11051104
Debug.WriteLine($"Ignored error in DISCOVER_CALC_DEPENDENCY: {ex.Message}");
11061105
}
1107-
catch (AmoException ex)
1106+
catch (Microsoft.AnalysisServices.AmoException ex)
11081107
{
11091108
Debug.WriteLine($"Ignored error in DISCOVER_CALC_DEPENDENCY: {ex.Message}");
11101109
}

src/Dax.Model.Extractor/StatExtractor.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using Dax.Model.Extractor.Data;
1+
using Dax.Metadata;
2+
using Dax.Model.Extractor.Data;
23
using System;
34
using System.Data;
45
using System.Linq;
56

6-
namespace Dax.Metadata.Extractor
7+
namespace Dax.Model.Extractor
78
{
89
public class StatExtractor
910
{

src/Dax.Model.Extractor/TomExtractor.cs

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
using Microsoft.AnalysisServices.AdomdClient;
1+
using Dax.Metadata;
2+
using Microsoft.AnalysisServices.AdomdClient;
23
using System;
34
using System.Data.OleDb;
45
using System.Linq;
56
using Tom = Microsoft.AnalysisServices.Tabular;
67

7-
namespace Dax.Metadata.Extractor
8+
namespace Dax.Model.Extractor
89
{
910
public class TomExtractor
1011
{
@@ -289,20 +290,21 @@ public static Dax.Metadata.Model GetDaxModel(string connectionString, string app
289290
string databaseName = database.Name;
290291
string serverName = GetDataSource(connectionString);
291292

292-
Model daxModel = Dax.Metadata.Extractor.TomExtractor.GetDaxModel(tomModel, applicationName, applicationVersion);
293+
var daxModel = TomExtractor.GetDaxModel(tomModel, applicationName, applicationVersion);
293294

294-
using (AdomdConnection connection = new(connectionString)) {
295+
using (AdomdConnection connection = new(connectionString))
296+
{
295297
// Populate statistics from DMV
296-
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
298+
DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
297299

298300
// Populate statistics by querying the data model
299301
if (readStatisticsFromData)
300302
{
301-
Dax.Metadata.Extractor.StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
303+
StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
302304

303305
// if we have forced all columns into memory then re-run the DMVs to update the data with the new values after everything has been transcoded.
304306
if (analyzeDirectLake > DirectLakeExtractionMode.ResidentOnly)
305-
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
307+
DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
306308
}
307309
}
308310
return daxModel;
@@ -344,23 +346,23 @@ public static Dax.Metadata.Model GetDaxModel(string serverName, string databaseN
344346
Tom.Database db = GetDatabase(serverName, databaseName);
345347
Tom.Model tomModel = db.Model;
346348

347-
Model daxModel = Dax.Metadata.Extractor.TomExtractor.GetDaxModel(tomModel, applicationName, applicationVersion);
349+
var daxModel = TomExtractor.GetDaxModel(tomModel, applicationName, applicationVersion);
348350

349351
string connectionString = GetConnectionString(serverName, databaseName);
350352

351353
using (AdomdConnection connection = new(connectionString))
352354
{
353355
// Populate statistics from DMV
354-
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
356+
DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
355357

356358
// Populate statistics by querying the data model
357359
if (readStatisticsFromData)
358360
{
359-
Dax.Metadata.Extractor.StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
361+
StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
360362

361363
// if we have forced all columns into memory then re-run the DMVs to update the data with the new values after everything has been transcoded.
362364
if (analyzeDirectLake > DirectLakeExtractionMode.ResidentOnly)
363-
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
365+
DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
364366
}
365367
}
366368
return daxModel;

src/Dax.Model.Extractor/Util.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Diagnostics;
55
using Tom = Microsoft.AnalysisServices;
66

7-
namespace Dax.Metadata.Extractor
7+
namespace Dax.Model.Extractor
88
{
99
internal class ExtractorInfo
1010
{

src/Dax.Vpax.Tests/VpaxToolTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Dax.Vpax.Tests
22
{
3-
using Dax.Metadata.Extractor;
3+
using Dax.Model.Extractor;
44
using Dax.Vpax.Tools;
55
using Microsoft.AnalysisServices;
66
using System;

0 commit comments

Comments
 (0)