-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update hotchocolate example with latest schema changes
- Loading branch information
1 parent
f3de5db
commit 95e56c6
Showing
9 changed files
with
171 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Products; | ||
|
||
public class CaseStudy | ||
{ | ||
|
||
public CaseStudy(string caseNumber, string? description) | ||
{ | ||
CaseNumber = caseNumber; | ||
Description = description; | ||
} | ||
|
||
[ID] | ||
public string CaseNumber { get; } | ||
public string? Description { 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
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,32 @@ | ||
using HotChocolate.ApolloFederation; | ||
|
||
namespace Products; | ||
|
||
[Key("sku package")] | ||
public class DeprecatedProduct | ||
{ | ||
public DeprecatedProduct(string sku, string package, string? reason, User? createdBy) | ||
{ | ||
Sku = sku; | ||
Package = package; | ||
Reason = reason; | ||
CreatedBy = createdBy; | ||
} | ||
|
||
public string Sku { get; } | ||
|
||
public string Package { get; } | ||
|
||
public string? Reason { get; } | ||
|
||
public User? CreatedBy { get; } | ||
|
||
[ReferenceResolver] | ||
public static DeprecatedProduct? GetProductByPackage( | ||
string sku, | ||
string package, | ||
Data repository) | ||
=> repository.DeprecatedProducts.FirstOrDefault( | ||
t => t.Sku.Equals(sku) && | ||
t.Package.Equals(package)); | ||
} |
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,27 @@ | ||
using HotChocolate.ApolloFederation; | ||
|
||
namespace Products; | ||
|
||
[Key("study { caseNumber }")] | ||
public class ProductResearch | ||
{ | ||
|
||
public ProductResearch(CaseStudy study, string? outcome) | ||
{ | ||
Study = study; | ||
Outcome = outcome; | ||
} | ||
|
||
public CaseStudy Study { get; } | ||
public string? Outcome { get; } | ||
|
||
[ReferenceResolver] | ||
public static ProductResearch? GetProductReasearchByCaseNumber( | ||
[Map("study.caseNumber")] string caseNumber, | ||
Data repository) | ||
{ | ||
Console.WriteLine("case number = {0}", caseNumber); | ||
return repository.ProductResearches.FirstOrDefault( | ||
r => r.Study.CaseNumber.Equals(caseNumber)); | ||
} | ||
} |
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