Created
February 9, 2022 20:46
-
-
Save PascalSenn/0f9d6c6824975575495877bdf266d586 to your computer and use it in GitHub Desktop.
Data Next
This file contains hidden or 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
public class Person | |
{ | |
public string FirstName { get; } | |
public string LastName { get; } | |
} | |
[ExtendObjectType(typeof(Person))] | |
public class PersonExtension | |
{ | |
public Expression DisplayName = (Person p ) => $"{p.FirstName} {p.LastName}"; | |
public string DisplayName( | |
[Field("firstName")]string firstName, | |
[Field("lastName")]string lastName]) | |
=> $"{p.FirstName} {p.LastName}"; | |
public string DisplayName( | |
[Member(nameof(Person.FirstName))]string firstName, | |
[Member(nameof(Person.LastName))]string lastName]) | |
=> $"{p.FirstName} {p.LastName}"; | |
} | |
public interface IFilterinContext{} | |
// customer land 🪄 | |
public static class FooBarDatabaseMapper | |
{ | |
public static FooBarQuery Map(this IFilteringContext context) { /* */} | |
} | |
/* | |
.Select(x => new Person { FirstName = x.FirstName, LastName = x.LastName, Displ}) | |
1. Map the output type to filtering | |
2. FilteringContext , ProjectionContext et al | |
3. lift expression from output type to filtering projection and sorting | |
3.1 Projection Engine | |
.Select(x => new object[] { x.FirstName, x.LastName, $"{x.FirstName} {x.LastName}"}) | |
firstName x => x.GetParent<object[]>()[0]; | |
lastName x => x.GetParent<object[]>()[1]; | |
displayName x => x.GetParent<object[]>()[1]; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment