Load connection from publish profile (#11263)

* initial changes for reading connection from profile

* connection string can now be read from publish.xml

* fix build errors and update test

* move publish profile tests to their own file

* cleanup

* update message

* fix string

* remove apiWrapper
This commit is contained in:
Kim Santiago
2020-07-15 17:03:25 -07:00
committed by GitHub
parent aae013d498
commit 0a1c2583cc
13 changed files with 247 additions and 69 deletions

View File

@@ -3,6 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import { DataSource } from './dataSources';
import * as constants from '../../common/constants';
@@ -70,6 +71,24 @@ export class SqlConnectionDataSource extends DataSource {
public static fromJson(json: DataSourceJson): SqlConnectionDataSource {
return new SqlConnectionDataSource(json.name, (json.data as unknown as SqlConnectionDataSourceJson).connectionString);
}
public getConnectionProfile(): azdata.IConnectionProfile {
const connProfile: azdata.IConnectionProfile = {
serverName: this.server,
databaseName: this.database,
connectionName: this.name,
userName: this.username,
password: this.password,
authenticationType: this.integratedSecurity ? 'Integrated' : 'SqlAuth',
savePassword: false,
providerName: 'MSSQL',
saveProfile: true,
id: this.name + '-dataSource',
options: []
};
return connProfile;
}
}
/**