Skip to content

Commit 8e5a062

Browse files
committed
dynamic to reflect, contracts update
1 parent ef81416 commit 8e5a062

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

src/NetCoreStack.Proxy/Internal/ProxyHelper.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal static class ProxyHelper
99
{
1010
internal static TProxy CreateProxy<TProxy>(IServiceProvider container) where TProxy : IApiContract
1111
{
12-
dynamic proxy = DispatchProxyAsync.Create<TProxy, HttpDispatchProxy>();
12+
object proxy = DispatchProxyAsync.Create<TProxy, HttpDispatchProxy>();
1313
var proxyContextFilter = container.GetRequiredService<IProxyContextFilter>();
1414
var proxyContext = new ProxyContext(typeof(TProxy));
1515

@@ -20,8 +20,15 @@ internal static TProxy CreateProxy<TProxy>(IServiceProvider container) where TPr
2020
}
2121

2222
proxyContextFilter.Invoke(proxyContext);
23-
proxy.Initialize(proxyContext, container.GetService<IProxyManager>());
24-
return proxy;
23+
24+
var initializer = proxy.GetType().GetMethod(nameof(HttpDispatchProxy.Initialize));
25+
if (initializer == null)
26+
{
27+
throw new ArgumentNullException(nameof(initializer));
28+
}
29+
30+
initializer.Invoke(proxy, new[] { proxyContext, (object)container.GetService<IProxyManager>() });
31+
return (TProxy)proxy;
2532
}
2633
}
2734
}

src/NetCoreStack.Proxy/NetCoreStack.Proxy.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.0.1" />
1212
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
1313
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
14-
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.6" />
14+
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.7" />
1515
<PackageReference Include="NetCoreStack.DispatchProxyAsync" Version="2.0.2" />
16-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
16+
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
1717
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
1818
</ItemGroup>
1919

test/NetCoreStack.Proxy.Mvc.Hosting/NetCoreStack.Proxy.Mvc.Hosting.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.1.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

test/NetCoreStack.Proxy.Test.Contracts/NetCoreStack.Proxy.Test.Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
9-
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.6" />
9+
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.7" />
1010
</ItemGroup>
1111

1212
</Project>

test/NetCoreStack.Proxy.Tests/NetCoreStack.Proxy.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.1" />
1212
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
1313
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
15-
<PackageReference Include="Moq" Version="4.8.1" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
15+
<PackageReference Include="Moq" Version="4.8.2" />
1616
<PackageReference Include="xunit" Version="2.3.1" />
1717
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
1818
</ItemGroup>
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)