mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
fix duplicate db references being allowed (#12795)
This commit is contained in:
@@ -435,6 +435,12 @@ export class Project {
|
|||||||
*/
|
*/
|
||||||
public async addProjectReference(settings: IProjectReferenceSettings): Promise<void> {
|
public async addProjectReference(settings: IProjectReferenceSettings): Promise<void> {
|
||||||
const projectReferenceEntry = new SqlProjectReferenceProjectEntry(settings);
|
const projectReferenceEntry = new SqlProjectReferenceProjectEntry(settings);
|
||||||
|
|
||||||
|
// check if reference to this database already exists
|
||||||
|
if (this.databaseReferenceExists(projectReferenceEntry)) {
|
||||||
|
throw new Error(constants.databaseReferenceAlreadyExists);
|
||||||
|
}
|
||||||
|
|
||||||
await this.addToProjFile(projectReferenceEntry);
|
await this.addToProjFile(projectReferenceEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,7 +627,7 @@ export class Project {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private databaseReferenceExists(entry: IDatabaseReferenceProjectEntry): boolean {
|
private databaseReferenceExists(entry: IDatabaseReferenceProjectEntry): boolean {
|
||||||
const found = this.databaseReferences.find(reference => reference.fsUri.fsPath === entry.fsUri.fsPath) !== undefined;
|
const found = this.databaseReferences.find(reference => reference.pathForSqlProj() === entry.pathForSqlProj()) !== undefined;
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user