fix: register api explorer in sandbox host
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<host xmlns="urn:m42/host.config">
|
<host xmlns="urn:m42/host.config">
|
||||||
<modules>
|
<modules>
|
||||||
|
<module assembly="C4ITF4SDM42WebApi" />
|
||||||
<module assembly="Matrix42.DataLayer.Persistence" />
|
<module assembly="Matrix42.DataLayer.Persistence" />
|
||||||
<module assembly="Matrix42.Services.WebApi" />
|
<module assembly="Matrix42.Services.WebApi" />
|
||||||
<module assembly="Matrix42.ServiceRepository.BizLogic" />
|
<module assembly="Matrix42.ServiceRepository.BizLogic" />
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||||
<M42ExtensionId>6673a25d-33d6-4072-91d9-abed4be1a966</M42ExtensionId>
|
<M42ExtensionId>6673a25d-33d6-4072-91d9-abed4be1a966</M42ExtensionId>
|
||||||
<M42AssemblyPattern>C4ITF4SD*.*</M42AssemblyPattern>
|
<M42AssemblyPattern>C4ITF4SD*.*</M42AssemblyPattern>
|
||||||
<M42PackageVersion>1.4.0.32</M42PackageVersion>
|
<M42PackageVersion>1.4.0.33</M42PackageVersion>
|
||||||
<M42BuildPackage>true</M42BuildPackage>
|
<M42BuildPackage>true</M42BuildPackage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -66,6 +66,10 @@
|
|||||||
<HintPath>M42Libraries\26.1\System.Net.Http.Formatting.dll</HintPath>
|
<HintPath>M42Libraries\26.1\System.Net.Http.Formatting.dll</HintPath>
|
||||||
<Private>false</Private>
|
<Private>false</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Http">
|
||||||
|
<HintPath>M42Libraries\26.1\System.Web.Http.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="update4u.SPS.DataLayer">
|
<Reference Include="update4u.SPS.DataLayer">
|
||||||
<HintPath>M42Libraries\26.1\update4u.SPS.DataLayer.dll</HintPath>
|
<HintPath>M42Libraries\26.1\update4u.SPS.DataLayer.dll</HintPath>
|
||||||
<Private>false</Private>
|
<Private>false</Private>
|
||||||
@@ -82,6 +86,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="cM42LogEntry.cs" />
|
<Compile Include="cM42LogEntry.cs" />
|
||||||
|
<Compile Include="F4SDM42DependencyRegistrator.cs" />
|
||||||
<Compile Include="F4SDHelperService.cs" />
|
<Compile Include="F4SDHelperService.cs" />
|
||||||
<Compile Include="F4SDM42WebApiController.cs" />
|
<Compile Include="F4SDM42WebApiController.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
38
F4SDM42WebApi/F4SDM42DependencyRegistrator.cs
Normal file
38
F4SDM42WebApi/F4SDM42DependencyRegistrator.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Http;
|
||||||
|
using System.Web.Http.Description;
|
||||||
|
|
||||||
|
using Matrix42.Hosting.Contracts;
|
||||||
|
|
||||||
|
using C4IT.Logging;
|
||||||
|
|
||||||
|
using static C4IT.Logging.cLogManager;
|
||||||
|
|
||||||
|
namespace C4IT.F4SD
|
||||||
|
{
|
||||||
|
public class F4SDM42DependencyRegistrator : IDependencyRegistrator
|
||||||
|
{
|
||||||
|
public void Register(IDependencyContainer container, IDependencyResolver resolver)
|
||||||
|
{
|
||||||
|
if (container == null)
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
|
||||||
|
if (resolver == null)
|
||||||
|
throw new ArgumentNullException(nameof(resolver));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (resolver.TryGet(typeof(IApiExplorer)) != null)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Existing mapping is incomplete in the sandbox host. Register a concrete instance below.
|
||||||
|
}
|
||||||
|
|
||||||
|
var httpConfiguration = new HttpConfiguration();
|
||||||
|
container.RegisterInstance(typeof(IApiExplorer), new ApiExplorer(httpConfiguration));
|
||||||
|
LogEntry("Registered System.Web.Http.Description.IApiExplorer for Matrix42 sandbox host.", LogLevels.Debug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -308,7 +308,7 @@ namespace C4IT.F4SD
|
|||||||
Values = vals.ToArray()
|
Values = vals.ToArray()
|
||||||
};
|
};
|
||||||
//CacheOutputAttribute.RegisterResponseEtag($"enum_{enumeration.Name}_{(int)mode}", $"{enumeration.Name}_{(int)mode}", cultureInvariant: false, userInvariant: true, val);
|
//CacheOutputAttribute.RegisterResponseEtag($"enum_{enumeration.Name}_{(int)mode}", $"{enumeration.Name}_{(int)mode}", cultureInvariant: false, userInvariant: true, val);
|
||||||
return Request.CreateResponse(HttpStatusCode.OK, enumeration);
|
return Matrix42.WebApi.Contracts.HttpResponseExtensions.CreateResponse(Request, HttpStatusCode.OK, enumeration);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("getMyRoleMemberships"), HttpGet]
|
[Route("getMyRoleMemberships"), HttpGet]
|
||||||
|
|||||||
Reference in New Issue
Block a user