fixed the issue with loading dlls for service provider (#312)

* fixed the issue with loading dlls for service provider
This commit is contained in:
Leila Lali
2017-04-13 15:57:56 -07:00
committed by GitHub
parent d903ba56a9
commit a1bc1bc344
6 changed files with 28 additions and 12 deletions

View File

@@ -124,12 +124,12 @@ namespace Microsoft.SqlTools.Extensibility
/// <param name="configure">Function that returns the configuration to be used</param>
public ExtensionStore(Type contractType, Func<ConventionBuilder, ContainerConfiguration> configure)
{
Validate.IsNotNull(nameof(contractType), contractType);
Validate.IsNotNull(nameof(configure), configure);
this.contractType = contractType;
ConventionBuilder builder = GetExportBuilder();
ContainerConfiguration config = configure(builder);
host = config.CreateContainer();
Validate.IsNotNull(nameof(contractType), contractType);
Validate.IsNotNull(nameof(configure), configure);
this.contractType = contractType;
ConventionBuilder builder = GetExportBuilder();
ContainerConfiguration config = configure(builder);
host = config.CreateContainer();
}
/// <summary>
@@ -222,7 +222,7 @@ namespace Microsoft.SqlTools.Extensibility
{
var asl = new AssemblyLoader(apiApplicationFileInfo.DirectoryName);
return asl.LoadFromAssemblyPath(apiApplicationFileInfo.FullName);
}
}
}
return Assembly.Load(assemblyName);
}

View File

@@ -3,7 +3,8 @@
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": false
"emitEntryPoint": false,
"preserveCompilationContext": true
},
"configurations": {
"Integration": {

View File

@@ -38,7 +38,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
public override void InitializeService(IProtocolEndpoint serviceHost)
{
{
Logger.Write(LogLevel.Verbose, "TSqlFormatter initialized");
serviceHost.SetRequestHandler(DocumentFormattingRequest.Type, HandleDocFormatRequest);
serviceHost.SetRequestHandler(DocumentRangeFormattingRequest.Type, HandleDocRangeFormatRequest);
WorkspaceService?.RegisterConfigChangeCallback(HandleDidChangeConfigurationNotification);

View File

@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
@@ -24,6 +25,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
/// A Service to support querying server and database information as an Object Explorer tree.
/// The APIs used for this are modeled closely on the VSCode TreeExplorerNodeProvider API.
/// </summary>
[Export(typeof(IHostedService))]
public class ObjectExplorerService : HostedService<ObjectExplorerService>, IComposableService
{
internal const string uriPrefix = "objectexplorer://";
@@ -79,6 +81,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
/// <param name="serviceHost">The service host instance to register with</param>
public override void InitializeService(IProtocolEndpoint serviceHost)
{
Logger.Write(LogLevel.Verbose, "ObjectExplorer service initialized");
this.serviceHost = serviceHost;
// Register handlers for requests
serviceHost.SetRequestHandler(CreateSessionRequest.Type, HandleCreateSessionRequest);
@@ -165,7 +168,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
{
// open connection based on request details
ConnectionCompleteParams result = await connectionService.Connect(connectParams);
return result;
if(result != null && !string.IsNullOrEmpty(result.ConnectionId))
{
return result;
}
else
{
await serviceHost.SendEvent(ConnectionCompleteNotification.Type, result);
return null;
}
}
catch (Exception ex)
{

View File

@@ -3,7 +3,8 @@
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"configurations": {
"Integration": {
@@ -33,7 +34,7 @@
"System.Threading.Thread": "4.0.0",
"System.Runtime.Loader": "4.0.0",
"System.Composition": "1.0.31-beta-24326-02",
"Microsoft.Extensions.DependencyModel": "1.0.0",
"Microsoft.Extensions.DependencyModel": "1.0.0",
"Microsoft.SqlTools.Hosting": {
"target": "project"
},

View File

@@ -115,6 +115,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
{
return new ConnectionCompleteParams()
{
ConnectionId = Guid.NewGuid().ToString(),
OwnerUri = uri,
ConnectionSummary = new ConnectionSummary()
{