diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8343e47..9047cba 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,17 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Use .NET Core 5.0 SDK
+ - name: Use .NET Core 6.0 SDK
uses: actions/setup-dotnet@v1
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '6.0.x'
source-url: https://nuget.pkg.github.com/Shane32/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build solution [Release]
- run: dotnet build --no-restore -c Release -p:NoWarn=CS1591 -p:VersionSuffix=$GITHUB_RUN_NUMBER
+ run: dotnet build --no-restore -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER
- name: Pack solution [Release]
run: dotnet pack --no-restore --no-build -c Release -p:VersionSuffix=$GITHUB_RUN_NUMBER -o out
- name: Upload artifacts
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 5692045..b0beb71 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -23,17 +23,17 @@ jobs:
version="${github_ref:10}"
echo version=$version
echo "version=$version" >> $GITHUB_ENV
- - name: Use .NET Core 5.0 SDK
+ - name: Use .NET Core 6.0 SDK
uses: actions/setup-dotnet@v1
with:
- dotnet-version: '5.0.x'
+ dotnet-version: '6.0.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build solution [Release]
- run: dotnet build --no-restore -c Release -p:NoWarn=CS1591 -p:Version=$version
+ run: dotnet build --no-restore -c Release -p:Version=$version
- name: Pack solution [Release]
run: dotnet pack --no-restore --no-build -c Release -p:Version=$version -o out
- name: Upload artifacts
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1aa58b5..08ace05 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,27 +21,19 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2
- - name: Use .NET Core 2.1 LTS SDK
- uses: actions/setup-dotnet@v1
+ - name: Use .NET Core SDK
+ uses: actions/setup-dotnet@v2
with:
- dotnet-version: '2.1.x'
- - name: Use .NET Core 3.1 LTS SDK
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '3.1.x'
- - name: Use .NET Core 5.0 SDK
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '5.0.x'
+ dotnet-version: 6.x
source-url: https://nuget.pkg.github.com/Shane32/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build solution [Release]
- run: dotnet build --no-restore -c Release -p:NoWarn=CS1591
+ run: dotnet build --no-restore -c Release
- name: Build solution [Debug]
- run: dotnet build --no-restore -p:NoWarn=CS1591
+ run: dotnet build --no-restore
- name: Test solution [Debug]
run: dotnet test --no-restore --no-build -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=../../${{ matrix.os }}.lcov.info
# ==== code coverage reports (ubuntu-latest only) ====
diff --git a/Directory.Build.props b/Directory.Build.props
index a7a3d2c..5264937 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,7 +2,7 @@
1.0.0-preview
- 8.0
+ latest
Shane Krueger
Shane Krueger
MIT
@@ -16,11 +16,20 @@
True
embedded
true
+ true
+ true
+ enable
+ false
+ README.md
+ Recommended
+ 7.0.0
+ 5.0.0
-
+
+
diff --git a/GraphQL.DI.sln b/GraphQL.DI.sln
index 0ad736e..4f0c101 100644
--- a/GraphQL.DI.sln
+++ b/GraphQL.DI.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30611.23
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shane32.GraphQL.DI", "src\GraphQL.DI\Shane32.GraphQL.DI.csproj", "{72C179A6-53BF-48BC-BFE0-BD8CA2618AF6}"
EndProject
@@ -18,7 +18,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "src\Tests\Tests.csproj", "{BA5F3790-9FE0-4A10-8528-0756334AC727}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{4AB70777-E140-49E4-8173-7809DF67A021}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample", "Sample\Sample.csproj", "{4AB70777-E140-49E4-8173-7809DF67A021}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{7432A0AF-9346-41D7-9DA9-D7EFEAF1A401}"
+ ProjectSection(SolutionItems) = preProject
+ .github\workflows\build.yml = .github\workflows\build.yml
+ .github\workflows\publish.yml = .github\workflows\publish.yml
+ .github\workflows\test.yml = .github\workflows\test.yml
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Sample/DataLoaders/PersonDataLoader.cs b/Sample/DataLoaders/PersonDataLoader.cs
index 0ca3b53..8fa88cf 100644
--- a/Sample/DataLoaders/PersonDataLoader.cs
+++ b/Sample/DataLoaders/PersonDataLoader.cs
@@ -1,27 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
using GraphQL.DataLoader;
using Microsoft.EntityFrameworkCore;
using Sample.DbModels;
-namespace Sample.DataLoaders
+namespace Sample.DataLoaders;
+
+public class PersonDataLoader : DataLoaderBase
{
- public class PersonDataLoader : DataLoaderBase
+ private readonly TodoDbContext _db;
+
+ public PersonDataLoader(TodoDbContext db)
{
- private TodoDbContext _db;
- public PersonDataLoader(TodoDbContext db) => _db = db;
+ _db = db;
+ }
- protected override async Task FetchAsync(IEnumerable> list, CancellationToken cancellationToken)
- {
- var ids = list.Select(x => x.Key);
- var people = await _db.Set().Where(x => ids.Contains(x.Id)).ToDictionaryAsync(x => x.Id, cancellationToken);
- foreach (var value in list) {
- people.TryGetValue(value.Key, out var person);
- value.SetResult(person);
- }
+ protected override async Task FetchAsync(IEnumerable> list, CancellationToken cancellationToken)
+ {
+ var ids = list.Select(x => x.Key);
+ var people = await _db.Set().Where(x => ids.Contains(x.Id)).ToDictionaryAsync(x => x.Id, cancellationToken);
+ foreach (var value in list) {
+ people.TryGetValue(value.Key, out var person);
+ value.SetResult(person);
}
}
}
diff --git a/Sample/DbModels/Person.cs b/Sample/DbModels/Person.cs
index 033cac3..98118f5 100644
--- a/Sample/DbModels/Person.cs
+++ b/Sample/DbModels/Person.cs
@@ -1,13 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+namespace Sample.DbModels;
-namespace Sample.DbModels
+public class Person
{
- public class Person
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
+ public int Id { get; set; }
+ public string Name { get; set; } = null!;
}
diff --git a/Sample/DbModels/Todo.cs b/Sample/DbModels/Todo.cs
index 470a1be..3ae521f 100644
--- a/Sample/DbModels/Todo.cs
+++ b/Sample/DbModels/Todo.cs
@@ -1,20 +1,15 @@
-using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Threading.Tasks;
-namespace Sample.DbModels
+namespace Sample.DbModels;
+
+public class Todo
{
- public class Todo
- {
- public int Id { get; set; }
- public string Title { get; set; }
- public string Notes { get; set; }
- public bool Completed { get; set; }
- public DateTime? CompletionDate { get; set; }
- public int? CompletedByPersonId { get; set; }
- [ForeignKey("CompletedByPersonId")]
- public Person CompletedBy { get; set; }
- }
+ public int Id { get; set; }
+ public string Title { get; set; } = null!;
+ public string Notes { get; set; } = null!;
+ public bool Completed { get; set; }
+ public DateTime? CompletionDate { get; set; }
+ public int? CompletedByPersonId { get; set; }
+ [ForeignKey("CompletedByPersonId")]
+ public Person CompletedBy { get; set; } = null!;
}
diff --git a/Sample/DoNotMapClrTypeAttribute.cs b/Sample/DoNotMapClrTypeAttribute.cs
index 7fc46fd..7f6a87d 100644
--- a/Sample/DoNotMapClrTypeAttribute.cs
+++ b/Sample/DoNotMapClrTypeAttribute.cs
@@ -1,16 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+namespace Sample;
-namespace Sample
+///
+/// Indicates that GetClrTypeMappings should
+/// skip this class when scanning an assembly for CLR type mappings.
+///
+[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+public class DoNotMapClrTypeAttribute : Attribute
{
- ///
- /// Indicates that GetClrTypeMappings should
- /// skip this class when scanning an assembly for CLR type mappings.
- ///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class DoNotMapClrTypeAttribute : Attribute
- {
- }
}
diff --git a/Sample/GraphTypes/MutationType.cs b/Sample/GraphTypes/MutationType.cs
index 181e2cf..7d0c838 100644
--- a/Sample/GraphTypes/MutationType.cs
+++ b/Sample/GraphTypes/MutationType.cs
@@ -1,55 +1,52 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using GraphQL.Types;
+using GraphQL;
using GraphQL.DI;
-using Sample.DbModels;
using Microsoft.EntityFrameworkCore;
-using GraphQL;
-using System.Threading;
+using Sample.DbModels;
+
+namespace Sample.GraphTypes;
-namespace Sample.GraphTypes
+public class MutationType : DIObjectGraphType { }
+public class Mutation : DIObjectGraphBase