Skip to content

Instantly share code, notes, and snippets.

@Alxandr
Last active July 30, 2021 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alxandr/a1c83dd94888ad0d4998dc8a6dcd0128 to your computer and use it in GitHub Desktop.
Save Alxandr/a1c83dd94888ad0d4998dc8a6dcd0128 to your computer and use it in GitHub Desktop.
[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