internal MsSqlKernel( string name, string connectionString, ToolsServiceClient client) : base(name, client) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(connectionString)); } _connectionString = connectionString; }
internal static async Task <bool> ConnectAsync(this ToolsServiceClient serviceClient, Uri ownerUri, string connectionStr) { var connectionOptions = new Dictionary <string, string>(); connectionOptions.Add("ConnectionString", connectionStr); var connectionDetails = new ConnectionDetails { Options = connectionOptions }; var connectionParams = new ConnectParams { OwnerUri = ownerUri.AbsolutePath, Connection = connectionDetails }; return(await serviceClient.ConnectAsync(connectionParams)); }
public async Task <Kernel> ConnectKernelAsync(KernelInfo kernelInfo) { if (string.IsNullOrWhiteSpace(PathToService)) { throw new InvalidOperationException($"{nameof(PathToService)} cannot be null or whitespace."); } var sqlClient = new ToolsServiceClient(PathToService, $"--parent-pid {Environment.ProcessId}"); var kernel = new MsSqlKernel( $"sql-{kernelInfo}", ConnectionString, sqlClient) .UseValueSharing(); kernel.RegisterForDisposal(sqlClient); await kernel.ConnectAsync(); return(kernel); }