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
Copy file name to clipboardExpand all lines: QueryKit.UnitTests/FilterParserTests.cs
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -762,4 +762,38 @@ public void can_throw_exception_when_invalid_enum_value()
762
762
act.Should().Throw<ParsingException>()
763
763
.WithMessage("There was a parsing failure, likely due to an invalid comparison or logical operator. You may also be missing double quotes surrounding a string or guid.*");
Copy file name to clipboardExpand all lines: README.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -590,17 +590,17 @@ public sealed class PersonConfiguration : IEntityTypeConfiguration<SpecialPerson
590
590
{
591
591
builder.HasKey(x=>x.Id);
592
592
593
-
// Option 1 (as of .NET 8)
593
+
// Option 1 (as of .NET 8) - ComplexProperty
594
594
builder.ComplexProperty(x=>x.Email,
595
595
x=>x.Property(y=>y.Value)
596
596
.HasColumnName("email"));
597
597
598
-
// Option 2
598
+
// Option 2 - HasConversion (see HasConversion support below)
599
599
builder.Property(x=>x.Email)
600
600
.HasConversion(x=>x.Value, x=>newEmailAddress(x))
601
601
.HasColumnName("email");
602
602
603
-
// Option 3
603
+
// Option 3 - OwnsOne
604
604
builder.OwnsOne(x=>x.Email, opts=>
605
605
{
606
606
opts.Property(x=>x.Value).HasColumnName("email");
@@ -610,8 +610,32 @@ public sealed class PersonConfiguration : IEntityTypeConfiguration<SpecialPerson
610
610
}
611
611
```
612
612
613
-
> **Warning**
614
-
> EF properties configured with `HasConversion` are not supported at this time
613
+
### HasConversion Support
614
+
615
+
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:
616
+
617
+
```c#
618
+
// EF configuration with HasConversion
619
+
builder.Property(x=>x.Email)
620
+
.HasConversion(x=>x.Value, x=>newEmailAddress(x))
621
+
.HasColumnName("email");
622
+
623
+
// QueryKit configuration for HasConversion properties
624
+
varconfig=newQueryKitConfiguration(config=>
625
+
{
626
+
config.Property<SpecialPerson>(x=>x.Email)
627
+
.HasQueryName("email")
628
+
.HasConversion<string>(); // Specify the target type used in HasConversion
629
+
});
630
+
631
+
// Now you can filter directly against the property:
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.
0 commit comments