Fix application names to respect connection's appname property (#2034)

This commit is contained in:
Cheena Malhotra
2023-04-28 13:39:33 -07:00
committed by GitHub
parent 35aa8d42de
commit f66a203c01
5 changed files with 19 additions and 19 deletions

View File

@@ -17,6 +17,7 @@ using Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts;
using Dac = Microsoft.Data.Tools.Sql.DesignServices.TableDesigner;
using STSHost = Microsoft.SqlTools.ServiceLayer.Hosting.ServiceHost;
using Microsoft.SqlTools.ServiceLayer.SqlContext;
using Microsoft.SqlTools.ServiceLayer.Connection;
namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
{
@@ -25,7 +26,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
/// </summary>
public sealed class TableDesignerService : IDisposable
{
public const string TableDesignerApplicationName = "azdata-table-designer";
public const string TableDesignerApplicationNameSuffix = "TableDesigner";
private Dictionary<string, Dac.TableDesigner> idTableMap = new Dictionary<string, Dac.TableDesigner>();
private bool disposed = false;
@@ -1798,7 +1799,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
{
var connectionStringBuilder = new SqlConnectionStringBuilder(tableInfo.ConnectionString);
connectionStringBuilder.InitialCatalog = tableInfo.Database;
connectionStringBuilder.ApplicationName = TableDesignerService.TableDesignerApplicationName;
connectionStringBuilder.ApplicationName = ConnectionService.GetApplicationNameWithFeature(connectionStringBuilder.ApplicationName, TableDesignerService.TableDesignerApplicationNameSuffix);
var connectionString = connectionStringBuilder.ToString();
// Set Access Token only when authentication mode is not specified.