Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/Infrastructure/Services/ConnectionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public AdomdConnection CreateAdomdConnection(bool open = true)
if (open)
{
connection.Open();
connection.ChangeDatabase(Database.Name);
}

return connection;
Expand Down Expand Up @@ -88,11 +87,10 @@ public static TabularConnectionWrapper ConnectTo(PBIDesktopReport report)

internal class AdomdConnectionWrapper : IDisposable
{
private AdomdConnectionWrapper(string connectionString, string databaseName)
private AdomdConnectionWrapper(string connectionString)
{
Connection = new AdomdConnection(connectionString);
ProcessHelper.RunOnUISynchronizationContext(() => Connection.Open());
Connection.ChangeDatabase(databaseName);

IsServerVersion13OrGreater = Version.TryParse(Connection.ServerVersion, out var version) && version >= new Version(13, 0);
}
Expand Down Expand Up @@ -134,20 +132,16 @@ public void Dispose()

public static AdomdConnectionWrapper ConnectTo(PBICloudDataset dataset, string accessToken)
{
BravoUnexpectedException.ThrowIfNull(dataset.ExternalDatabaseName);

var connectionString = ConnectionStringHelper.BuildFor(dataset, accessToken);
var connection = new AdomdConnectionWrapper(connectionString, dataset.ExternalDatabaseName);
var connection = new AdomdConnectionWrapper(connectionString);

return connection;
}

public static AdomdConnectionWrapper ConnectTo(PBIDesktopReport report)
{
BravoUnexpectedException.ThrowIfNull(report.DatabaseName);

var connectionString = ConnectionStringHelper.BuildFor(report);
var connection = new AdomdConnectionWrapper(connectionString, report.DatabaseName);
var connection = new AdomdConnectionWrapper(connectionString);

return connection;
}
Expand Down
Loading