You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -610,6 +613,10 @@ public sealed class PersonConfiguration : IEntityTypeConfiguration<SpecialPerson
610
613
}
611
614
```
612
615
616
+
**Key Distinction:**
617
+
-**HasConversion**: Use `x => x.Email` in QueryKit (point to parent property)
618
+
-**ComplexProperty/OwnsOne**: Use `x => x.Email.Value` in QueryKit (point to nested property)
619
+
613
620
### HasConversion Support
614
621
615
622
For properties configured with EF Core's `HasConversion`, QueryKit provides special support that allows you to filter against the property directly without needing to access nested values. Use the `HasConversion<TTarget>()` configuration method:
// QueryKit configuration for HasConversion properties
624
631
varconfig=newQueryKitConfiguration(config=>
625
632
{
626
-
config.Property<SpecialPerson>(x=>x.Email)
633
+
config.Property<SpecialPerson>(x=>x.Email)// Point to Email property, NOT Email.Value
627
634
.HasQueryName("email")
628
635
.HasConversion<string>(); // Specify the target type used in HasConversion
629
636
});
@@ -637,6 +644,8 @@ var people = _dbContext.People
637
644
638
645
This allows you to use `Email == "value"` syntax instead of `Email.Value == "value"` when the property is configured with HasConversion in EF Core. The `HasConversion<TTarget>()` method tells QueryKit what the conversion target type is so it can handle the type conversion properly.
639
646
647
+
> **Important:** When using `HasConversion` in EF Core, you MUST configure the property in QueryKit using `x => x.Email`, not `x => x.Email.Value`. The conversion is on the parent property, so pointing to the nested `.Value` property will cause EF Core translation errors. Use `x => x.Email.Value` only when using `ComplexProperty` or `OwnsOne` without HasConversion.
648
+
640
649
## Sorting
641
650
642
651
Sorting is a more simplistic flow. It's just an input with a comma delimited list of properties to sort by.
0 commit comments