-
-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from ChilliCream/next-version
- Loading branch information
Showing
218 changed files
with
6,982 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dotnet build src | ||
dotnet test src/Runtime.Tests | ||
dotnet test src/Language.Tests | ||
dotnet test src/Core.Tests | ||
dotnet test src/AspNetCore.Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dotnet build src | ||
dotnet test src/Runtime.Tests | ||
dotnet test src/Language.Tests --no-build | ||
dotnet test src/Core.Tests --no-build | ||
dotnet test src/AspNetCore.Tests --no-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace HotChocolate | ||
{ | ||
[AttributeUsage(AttributeTargets.Parameter)] | ||
public sealed class DataLoaderAttribute | ||
: Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace HotChocolate | ||
{ | ||
public interface IResolverResult | ||
{ | ||
string ErrorMessage { get; } | ||
|
||
bool IsError { get; } | ||
|
||
object Value { get; } | ||
} | ||
|
||
public interface IResolverResult<out TValue> | ||
: IResolverResult | ||
{ | ||
new TValue Value { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
|
||
namespace HotChocolate | ||
{ | ||
public readonly struct ResolverResult<TValue> | ||
: IResolverResult<TValue> | ||
{ | ||
public ResolverResult(string errorMessage) | ||
{ | ||
Value = default; | ||
ErrorMessage = errorMessage | ||
?? throw new ArgumentNullException(nameof(errorMessage)); | ||
IsError = true; | ||
} | ||
|
||
public ResolverResult(TValue value) | ||
{ | ||
Value = default; | ||
ErrorMessage = null; | ||
IsError = false; | ||
} | ||
|
||
public TValue Value { get; } | ||
|
||
public string ErrorMessage { get; } | ||
|
||
public bool IsError { get; } | ||
|
||
object IResolverResult.Value => Value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace HotChocolate | ||
{ | ||
[AttributeUsage(AttributeTargets.Parameter)] | ||
public sealed class ServiceAttribute | ||
: Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace HotChocolate | ||
{ | ||
[AttributeUsage(AttributeTargets.Parameter)] | ||
public sealed class StateAttribute | ||
: Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace HotChocolate.AspNetCore | ||
{ | ||
public class TestService | ||
{ | ||
public string GetGreetings() => "Hello World"; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/AspNetCore.Tests/__snapshots__/HttpPost_WithHttpContext.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Data": { | ||
"requestPath": "/", | ||
"requestPath2": "/", | ||
"requestPath3": "/" | ||
}, | ||
"Errors": null | ||
} |
6 changes: 6 additions & 0 deletions
6
src/AspNetCore.Tests/__snapshots__/HttpPost_WithScopedService.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Data": { | ||
"sayHello": "Hello World" | ||
}, | ||
"Errors": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace HotChocolate.AspNetCore | ||
{ | ||
public class RequestServiceProvider | ||
: IServiceProvider | ||
{ | ||
private readonly IServiceProvider _root; | ||
private readonly Dictionary<Type, object> _services; | ||
|
||
public RequestServiceProvider( | ||
IServiceProvider root, | ||
IEnumerable<KeyValuePair<Type, object>> services) | ||
{ | ||
if (services == null) | ||
{ | ||
throw new ArgumentNullException(nameof(services)); | ||
} | ||
|
||
_services = services.ToDictionary(t => t.Key, t => t.Value); | ||
_root = root ?? throw new ArgumentNullException(nameof(root)); | ||
} | ||
|
||
public object GetService(Type serviceType) | ||
{ | ||
if (serviceType == null) | ||
{ | ||
throw new ArgumentNullException(nameof(serviceType)); | ||
} | ||
|
||
if (!_services.TryGetValue(serviceType, out object instance)) | ||
{ | ||
instance = _root.GetService(serviceType); | ||
} | ||
return instance; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.