Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ public static void RegisterInContainer<TDbContext>(
ResolveDbContext<TDbContext>? resolveDbContext = null,
IModel? model = null,
ResolveFilters<TDbContext>? resolveFilters = null,
bool disableTracking = false,
bool disableAsync = false)
bool disableTracking = false)
```
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L14-L24' title='Snippet source file'>snippet source</a> | <a href='#snippet-RegisterInContainer' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L14-L23' title='Snippet source file'>snippet source</a> | <a href='#snippet-RegisterInContainer' title='Start of snippet'>anchor</a></sup>
<a id='snippet-RegisterInContainer-1'></a>
```cs
EfGraphQLConventions.RegisterInContainer<MyDbContext>(
Expand Down Expand Up @@ -123,10 +122,9 @@ public static void RegisterInContainer<TDbContext>(
ResolveDbContext<TDbContext>? resolveDbContext = null,
IModel? model = null,
ResolveFilters<TDbContext>? resolveFilters = null,
bool disableTracking = false,
bool disableAsync = false)
bool disableTracking = false)
```
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L14-L24' title='Snippet source file'>snippet source</a> | <a href='#snippet-RegisterInContainer' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L14-L23' title='Snippet source file'>snippet source</a> | <a href='#snippet-RegisterInContainer' title='Start of snippet'>anchor</a></sup>
<a id='snippet-RegisterInContainer-1'></a>
```cs
EfGraphQLConventions.RegisterInContainer<MyDbContext>(
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;NU5104;CS1573;CS9107;NU1608;NU1109</NoWarn>
<Version>31.0.5</Version>
<Version>32.0.0</Version>
<LangVersion>preview</LangVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>EntityFrameworkCore, EntityFramework, GraphQL</PackageTags>
Expand Down
11 changes: 4 additions & 7 deletions src/GraphQL.EntityFramework/EfGraphQLConventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public static void RegisterInContainer<TDbContext>(
ResolveDbContext<TDbContext>? resolveDbContext = null,
IModel? model = null,
ResolveFilters<TDbContext>? resolveFilters = null,
bool disableTracking = false,
bool disableAsync = false)
bool disableTracking = false)

#endregion

Expand All @@ -28,7 +27,7 @@ public static void RegisterInContainer<TDbContext>(
RegisterScalarsAndArgs(services);
services.AddHttpContextAccessor();
services.AddTransient<HttpContextCapture>();
services.AddSingleton(provider => Build(resolveDbContext, model, resolveFilters, provider, disableTracking, disableAsync));
services.AddSingleton(provider => Build(resolveDbContext, model, resolveFilters, provider, disableTracking));
services.AddSingleton<IEfGraphQLService<TDbContext>>(provider => provider.GetRequiredService<EfGraphQLService<TDbContext>>());
}

Expand All @@ -37,8 +36,7 @@ static EfGraphQLService<TDbContext> Build<TDbContext>(
IModel? model,
ResolveFilters<TDbContext>? filters,
IServiceProvider provider,
bool disableTracking,
bool disableAsync)
bool disableTracking)
where TDbContext : DbContext
{
model ??= ResolveModel<TDbContext>(provider);
Expand All @@ -49,8 +47,7 @@ static EfGraphQLService<TDbContext> Build<TDbContext>(
model,
dbContextResolver,
filters,
disableTracking,
disableAsync);
disableTracking);
}

static TDbContext DbContextFromProvider<TDbContext>(IServiceProvider provider, IServiceProvider? requestServices)
Expand Down
5 changes: 1 addition & 4 deletions src/GraphQL.EntityFramework/GraphApi/EfGraphQLService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public partial class EfGraphQLService<TDbContext> :
{
ResolveFilters<TDbContext>? resolveFilters;
bool disableTracking;
bool disableAsync;
ResolveDbContext<TDbContext> resolveDbContext;
IReadOnlyDictionary<Type, List<string>> keyNames;

Expand All @@ -15,12 +14,10 @@ public EfGraphQLService(
IModel model,
ResolveDbContext<TDbContext> resolveDbContext,
ResolveFilters<TDbContext>? resolveFilters = null,
bool disableTracking = false,
bool disableAsync = false)
bool disableTracking = false)
{
this.resolveFilters = resolveFilters;
this.disableTracking = disableTracking;
this.disableAsync = disableAsync;
this.resolveDbContext = resolveDbContext;

keyNames = model.GetKeyNames();
Expand Down
10 changes: 1 addition & 9 deletions src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_First.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,7 @@ FieldType BuildFirstField<TSource, TReturn>(
TReturn? first;
try
{
if (disableAsync)
{
first = query.FirstOrDefault();
}
else
{
first = await query.FirstOrDefaultAsync(context.CancellationToken);
}
first = await query.FirstOrDefaultAsync(context.CancellationToken);
}
catch (TaskCanceledException)
{
Expand All @@ -184,7 +177,6 @@ FieldType BuildFirstField<TSource, TReturn>(
GraphType: {graphType.FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
OmitQueryArguments: {omitQueryArguments}
Nullable: {nullable}
KeyNames: {JoinKeys(names)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public ConnectionBuilder<TSource> AddNavigationConnectionField<TSource, TReturn>
ItemGraphType: {itemGraphType.FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
""",
exception);
}
Expand Down Expand Up @@ -88,7 +87,6 @@ ConnectionBuilder<TSource> AddEnumerableConnection<TSource, TGraph, TReturn>(
TGraph: {typeof(TGraph).FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
""",
exception);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,8 @@ FieldType BuildQueryField<TSource, TReturn>(

try
{
if (disableAsync)
{
list = query.ToList();
}
else
{
list = await query
.ToListAsync(context.CancellationToken);
}
}
catch (TaskCanceledException)
{
Expand All @@ -137,7 +130,6 @@ FieldType BuildQueryField<TSource, TReturn>(
TReturn: {typeof(TReturn).FullName}
DisableTracking: {disableTracking}
HasId: {hasId}
DisableAsync: {disableAsync}
KeyNames: {JoinKeys(names)}
Query: {query.ToQueryString()}
""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public ConnectionBuilder<object> AddQueryConnectionField<TReturn>(
Failed to execute query for field `{name}`
ItemGraphType: {itemGraphType.FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
""",
exception);
}
Expand Down Expand Up @@ -114,7 +113,6 @@ public ConnectionBuilder<TSource> AddQueryConnectionField<TSource, TReturn>(
ItemGraphType: {itemGraphType.FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
""",
exception);
}
Expand Down Expand Up @@ -175,7 +173,6 @@ ConnectionBuilder<TSource> AddQueryableConnection<TSource, TGraph, TReturn>(
TGraph: {typeof(TGraph).FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
KeyNames: {JoinKeys(names)}
Query: {query.ToQueryString()}
""",
Expand Down
10 changes: 1 addition & 9 deletions src/GraphQL.EntityFramework/GraphApi/EfGraphQLService_Single.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,7 @@ FieldType BuildSingleField<TSource, TReturn>(
TReturn? single;
try
{
if (disableAsync)
{
single = query.SingleOrDefault();
}
else
{
single = await query.SingleOrDefaultAsync(context.CancellationToken);
}
single = await query.SingleOrDefaultAsync(context.CancellationToken);
}
catch (TaskCanceledException)
{
Expand All @@ -185,7 +178,6 @@ FieldType BuildSingleField<TSource, TReturn>(
GraphType: {graphType.FullName}
TSource: {typeof(TSource).FullName}
TReturn: {typeof(TReturn).FullName}
DisableAsync: {disableAsync}
OmitQueryArguments: {omitQueryArguments}
Nullable: {nullable}
KeyNames: {JoinKeys(names)}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading