Skip to content

Commit be2898a

Browse files
committed
global usings
1 parent cca88f9 commit be2898a

42 files changed

Lines changed: 75 additions & 123 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public static void RegisterInContainer<TDbContext>(
2525
bool disableTracking = false,
2626
bool disableAsync = false)
2727
```
28-
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L17-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer' title='Start of snippet'>anchor</a></sup>
28+
<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>
2929
<a id='snippet-registerincontainer-1'></a>
3030
```cs
3131
EfGraphQLConventions.RegisterInContainer<MyDbContext>(
3232
serviceCollection,
3333
model: ModelBuilder.GetInstance());
3434
```
35-
<sup><a href='/src/Snippets/Configuration.cs#L23-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer-1' title='Start of snippet'>anchor</a></sup>
35+
<sup><a href='/src/Snippets/Configuration.cs#L20-L24' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer-1' title='Start of snippet'>anchor</a></sup>
3636
<!-- endSnippet -->
3737

3838

@@ -59,7 +59,7 @@ static class ModelBuilder
5959
}
6060
}
6161
```
62-
<sup><a href='/src/Snippets/Configuration.cs#L8-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-modelbuilder' title='Start of snippet'>anchor</a></sup>
62+
<sup><a href='/src/Snippets/Configuration.cs#L5-L16' title='Snippet source file'>snippet source</a> | <a href='#snippet-modelbuilder' title='Start of snippet'>anchor</a></sup>
6363
<!-- endSnippet -->
6464

6565

@@ -125,14 +125,14 @@ public static void RegisterInContainer<TDbContext>(
125125
bool disableTracking = false,
126126
bool disableAsync = false)
127127
```
128-
<sup><a href='/src/GraphQL.EntityFramework/EfGraphQLConventions.cs#L17-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer' title='Start of snippet'>anchor</a></sup>
128+
<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>
129129
<a id='snippet-registerincontainer-1'></a>
130130
```cs
131131
EfGraphQLConventions.RegisterInContainer<MyDbContext>(
132132
serviceCollection,
133133
model: ModelBuilder.GetInstance());
134134
```
135-
<sup><a href='/src/Snippets/Configuration.cs#L23-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer-1' title='Start of snippet'>anchor</a></sup>
135+
<sup><a href='/src/Snippets/Configuration.cs#L20-L24' title='Snippet source file'>snippet source</a> | <a href='#snippet-registerincontainer-1' title='Start of snippet'>anchor</a></sup>
136136
<!-- endSnippet -->
137137

138138
Then the `IEfGraphQLService` can be resolved via [dependency injection in GraphQL.net](https://graphql-dotnet.github.io/docs/guides/advanced#dependency-injection) to be used in `ObjectGraphType`s when adding query fields.

docs/defining-graphs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class Query :
7474
}
7575
}
7676
```
77-
<sup><a href='/src/Snippets/RootQuery.cs#L8-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-rootquery' title='Start of snippet'>anchor</a></sup>
77+
<sup><a href='/src/Snippets/RootQuery.cs#L5-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-rootquery' title='Start of snippet'>anchor</a></sup>
7878
<!-- endSnippet -->
7979

8080
`AddQueryField` will result in all matching being found and returned.
@@ -104,7 +104,7 @@ public class CompanyGraph :
104104
}
105105
}
106106
```
107-
<sup><a href='/src/Snippets/TypedGraph.cs#L7-L26' title='Snippet source file'>snippet source</a> | <a href='#snippet-typedgraph' title='Start of snippet'>anchor</a></sup>
107+
<sup><a href='/src/Snippets/TypedGraph.cs#L5-L24' title='Snippet source file'>snippet source</a> | <a href='#snippet-typedgraph' title='Start of snippet'>anchor</a></sup>
108108
<!-- endSnippet -->
109109

110110

@@ -131,7 +131,7 @@ public class Query :
131131
resolve: context => context.DbContext.Companies);
132132
}
133133
```
134-
<sup><a href='/src/Snippets/ConnectionRootQuery.cs#L6-L18' title='Snippet source file'>snippet source</a> | <a href='#snippet-connectionrootquery' title='Start of snippet'>anchor</a></sup>
134+
<sup><a href='/src/Snippets/ConnectionRootQuery.cs#L3-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-connectionrootquery' title='Start of snippet'>anchor</a></sup>
135135
<!-- endSnippet -->
136136

137137

@@ -224,7 +224,7 @@ public class CompanyGraph :
224224
resolve: context => context.Source.Employees);
225225
}
226226
```
227-
<sup><a href='/src/Snippets/ConnectionTypedGraph.cs#L7-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-connectiontypedgraph' title='Start of snippet'>anchor</a></sup>
227+
<sup><a href='/src/Snippets/ConnectionTypedGraph.cs#L5-L17' title='Snippet source file'>snippet source</a> | <a href='#snippet-connectiontypedgraph' title='Start of snippet'>anchor</a></sup>
228228
<!-- endSnippet -->
229229

230230

@@ -361,7 +361,7 @@ public class Query :
361361
});
362362
}
363363
```
364-
<sup><a href='/src/Snippets/ResolveDbContextQuery.cs#L7-L23' title='Snippet source file'>snippet source</a> | <a href='#snippet-queryresolvedbcontext' title='Start of snippet'>anchor</a></sup>
364+
<sup><a href='/src/Snippets/ResolveDbContextQuery.cs#L5-L21' title='Snippet source file'>snippet source</a> | <a href='#snippet-queryresolvedbcontext' title='Start of snippet'>anchor</a></sup>
365365
<!-- endSnippet -->
366366

367367

docs/filters.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class MyEntity
4848
public string? Property { get; set; }
4949
}
5050
```
51-
<sup><a href='/src/Snippets/GlobalFilterSnippets.cs#L8-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-add-filter' title='Start of snippet'>anchor</a></sup>
51+
<sup><a href='/src/Snippets/GlobalFilterSnippets.cs#L5-L12' title='Snippet source file'>snippet source</a> | <a href='#snippet-add-filter' title='Start of snippet'>anchor</a></sup>
5252
<a id='snippet-add-filter-1'></a>
5353
```cs
5454
var filters = new Filters();
@@ -58,5 +58,5 @@ EfGraphQLConventions.RegisterInContainer<MyDbContext>(
5858
services,
5959
resolveFilters: x => filters);
6060
```
61-
<sup><a href='/src/Snippets/GlobalFilterSnippets.cs#L19-L28' title='Snippet source file'>snippet source</a> | <a href='#snippet-add-filter-1' title='Start of snippet'>anchor</a></sup>
61+
<sup><a href='/src/Snippets/GlobalFilterSnippets.cs#L16-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-add-filter-1' title='Start of snippet'>anchor</a></sup>
6262
<!-- endSnippet -->

src/GraphQL.EntityFramework/EfGraphQLConventions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
2-
using Microsoft.Extensions.DependencyInjection;
3-
41
namespace GraphQL.EntityFramework;
52

63
public static class EfGraphQLConventions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Global using directives
2+
3+
global using Microsoft.AspNetCore.Http;
4+
global using Microsoft.EntityFrameworkCore.Metadata;
5+
global using Microsoft.Extensions.DependencyInjection;

src/GraphQL.EntityFramework/GraphApi/EfGraphQLService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
2-
31
namespace GraphQL.EntityFramework;
42

53
public partial class EfGraphQLService<TDbContext> :

src/GraphQL.EntityFramework/HttpContextCapture.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Microsoft.AspNetCore.Http;
2-
3-
class HttpContextCapture
1+
class HttpContextCapture
42
{
53
public IHttpContextAccessor HttpContextAccessor { get; }
64

src/GraphQL.EntityFramework/KeyNameExtractor.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
2-
3-
static class KeyNameExtractor
1+
static class KeyNameExtractor
42
{
53
public static IReadOnlyDictionary<Type, List<string>> GetKeyNames(this IModel model)
64
{

src/GraphQL.EntityFramework/NavigationReader.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
2-
3-
static class NavigationReader
1+
static class NavigationReader
42
{
53
public static IReadOnlyDictionary<Type, IReadOnlyList<Navigation>> GetNavigationProperties(IModel model)
64
{
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Global using directives
2+
3+
global using GraphQL.EntityFramework.Testing;
4+
global using GraphQL.Types;
5+
global using GraphQL.Utilities;
6+
global using Microsoft.AspNetCore.Hosting;
7+
global using Microsoft.AspNetCore.TestHost;
8+
global using Microsoft.Extensions.DependencyInjection;
9+
global using Microsoft.Extensions.Logging;
10+
global using Microsoft.Extensions.Logging.Abstractions;

0 commit comments

Comments
 (0)