Last active
July 30, 2021 07:50
-
-
Save Alxandr/a1c83dd94888ad0d4998dc8a6dcd0128 to your computer and use it in GitHub Desktop.
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
[Node] | |
public class Foo | |
{ | |
private readonly FooDto _dto; | |
public Foo(FooDto dto) | |
=> _dto = dto; | |
// Optional attribute - this is as an alternative to use `[Node(IdField = "Id")]` - and not needed when the field is called "Id". | |
// I just think this is a better discovery mechanism than Setting an `IdField`. It's also more similar to thinks like `[Key]` etc. | |
[NodeId] | |
public ComplexId Id => _dtl.Id; | |
// ... | |
} | |
// gets registered with the DI container | |
public class FooResolver | |
: INodeResolver<ComplexId, Foo> | |
{ | |
public bool TryResolve(CompledId id, [NotNullWhen(true)] Foo? value) | |
{ | |
// impl | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment