mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-28 09:35:37 -05:00
Provide connection options to host process (#267)
* Stage changes to other machine * Add connection options in init message * Fix option type
This commit is contained in:
@@ -62,8 +62,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Hosting
|
||||
public void InitializeRequestHandlers()
|
||||
{
|
||||
// Register the requests that this service host will handle
|
||||
this.SetRequestHandler(InitializeRequest.Type, this.HandleInitializeRequest);
|
||||
this.SetRequestHandler(ShutdownRequest.Type, this.HandleShutdownRequest);
|
||||
this.SetRequestHandler(InitializeRequest.Type, HandleInitializeRequest);
|
||||
this.SetRequestHandler(CapabilitiesRequest.Type, HandleCapabilitiesRequest);
|
||||
this.SetRequestHandler(ShutdownRequest.Type, HandleShutdownRequest);
|
||||
this.SetRequestHandler(VersionRequest.Type, HandleVersionRequest);
|
||||
}
|
||||
|
||||
@@ -171,6 +172,140 @@ namespace Microsoft.SqlTools.ServiceLayer.Hosting
|
||||
});
|
||||
}
|
||||
|
||||
internal async Task HandleCapabilitiesRequest(
|
||||
CapabilitiesRequest initializeParams,
|
||||
RequestContext<CapabilitiesResult> requestContext)
|
||||
{
|
||||
await requestContext.SendResult(
|
||||
new CapabilitiesResult
|
||||
{
|
||||
Capabilities = new DmpServerCapabilities
|
||||
{
|
||||
ProtocolVersion = "1.0",
|
||||
ProviderName = "MSSQL",
|
||||
ProviderDisplayName = "Microsoft SQL Server",
|
||||
ConnectionProvider = ServiceHost.BuildConnectionProviderOptions()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private static ConnectionProviderOptions BuildConnectionProviderOptions()
|
||||
{
|
||||
return new ConnectionProviderOptions
|
||||
{
|
||||
Options = new ConnectionOption[]
|
||||
{
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Server Name",
|
||||
ValueType = ConnectionOption.ValueTypeString,
|
||||
SpecialValueType = ConnectionOption.SpecialValueServerName,
|
||||
IsIdentity = true,
|
||||
IsRequired = true
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Initial Catalog",
|
||||
DisplayName = "Database Name",
|
||||
ValueType = ConnectionOption.ValueTypeString,
|
||||
SpecialValueType = ConnectionOption.SpecialValueDatabaseName,
|
||||
IsIdentity = true,
|
||||
IsRequired = true
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Auth Type",
|
||||
ValueType = ConnectionOption.ValueTypeCategory,
|
||||
SpecialValueType = ConnectionOption.SpecialValueAuthType,
|
||||
CategoryValues = new string[] { "SQL Login", "Integrated Auth" },
|
||||
IsIdentity = true,
|
||||
IsRequired = true
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Username",
|
||||
ValueType = ConnectionOption.ValueTypeString,
|
||||
SpecialValueType = ConnectionOption.SpecialValueUserName,
|
||||
IsIdentity = true,
|
||||
IsRequired = true
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Password",
|
||||
DisplayName = "Database Name",
|
||||
ValueType = ConnectionOption.ValueTypePassword,
|
||||
SpecialValueType = ConnectionOption.SpecialValuePasswordName,
|
||||
IsIdentity = true,
|
||||
IsRequired = true
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Application Intent",
|
||||
ValueType = ConnectionOption.ValueTypeCategory,
|
||||
CategoryValues = new string[] { "ReadWrite", "ReadOnly" }
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Asynchronous Processing",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Connect Timeout",
|
||||
ValueType = ConnectionOption.ValueTypeNumber,
|
||||
DefaultValue = "15"
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Current Language",
|
||||
ValueType = ConnectionOption.ValueTypeString
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Column Encrytion Setting",
|
||||
ValueType = ConnectionOption.ValueTypeCategory,
|
||||
CategoryValues = new string[] { "Disabled", "Enabled" }
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Encrypt",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Persist Security Info",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Trust Server Certificate",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Persist Security Info",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Trust Server Certificate",
|
||||
ValueType = ConnectionOption.ValueTypeBoolean
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Attached DB File Name",
|
||||
ValueType = ConnectionOption.ValueTypeString
|
||||
},
|
||||
new ConnectionOption
|
||||
{
|
||||
Name = "Context Connection",
|
||||
ValueType = ConnectionOption.ValueTypeString
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the version request. Sends back the server version as result.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user