Skip to content

Commit 06a6a55

Browse files
committed
fix(transactions): locate services using request scoped service provider
1 parent bae4a78 commit 06a6a55

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/JsonApiDotNetCore/Internal/Generics/GenericProcessorFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ public interface IGenericProcessorFactory
1414
/// Constructs the generic type and locates the service, then casts to TInterface
1515
/// </summary>
1616
/// <example>
17+
/// <code>
1718
/// GetProcessor&lt;IGenericProcessor&gt;(typeof(GenericProcessor&lt;&gt;), typeof(TResource));
19+
/// </code>
1820
/// </example>
1921
TInterface GetProcessor<TInterface>(Type openGenericType, Type resourceType);
2022

2123
/// <summary>
2224
/// Constructs the generic type and locates the service, then casts to TInterface
2325
/// </summary>
2426
/// <example>
27+
/// <code>
2528
/// GetProcessor&lt;IGenericProcessor&gt;(typeof(GenericProcessor&lt;,&gt;), typeof(TResource), typeof(TId));
29+
/// </code>
2630
/// </example>
2731
TInterface GetProcessor<TInterface>(Type openGenericType, Type resourceType, Type keyType);
2832
}

test/JsonApiDotNetCoreExampleTests/Acceptance/TestFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Hosting;
66
using Microsoft.AspNetCore.TestHost;
77
using JsonApiDotNetCore.Services;
8+
using JsonApiDotNetCore.Data;
89

910
namespace JsonApiDotNetCoreExampleTests.Acceptance
1011
{
@@ -22,7 +23,7 @@ public TestFixture()
2223
_services = _server.Host.Services;
2324

2425
Client = _server.CreateClient();
25-
Context = GetService<AppDbContext>();
26+
Context = GetService<IDbContextResolver>().GetContext() as AppDbContext;
2627
DeSerializer = GetService<IJsonApiDeSerializer>();
2728
JsonApiContext = GetService<IJsonApiContext>();
2829
}

0 commit comments

Comments
 (0)