Skip to content

Commit c882576

Browse files
committed
Rebase fixes
1 parent 7a67163 commit c882576

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/FSharp.Data.GraphQL.Server.Middleware/ObjectListFilter.fs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ open System.Runtime.InteropServices
4040

4141
type private CompareDiscriminatorExpression<'T, 'D> = Expression<Func<'T, 'D, bool>>
4242

43-
// ────────────────────────────────────────────────────────────────────────────
44-
// Type Coercion Support
45-
// ────────────────────────────────────────────────────────────────────────────
46-
4743
/// <summary>
4844
/// Validation error raised when an incoming <see cref="ObjectListFilter"/> cannot be
4945
/// translated to a LINQ expression against the queried entity type.
@@ -54,6 +50,32 @@ type ObjectListFilterValidationException (message : string, [<Optional>] extensi
5450
/// <summary>
5551
/// Optional configuration for LINQ translation including discriminator handling.
5652
/// </summary>
53+
/// <example id="item-1"><code lang="fsharp">
54+
/// // discriminator custom condition
55+
/// let result () =
56+
/// queryable.Apply(
57+
/// filter,
58+
/// ObjectListFilterLinqOptions (
59+
/// (fun entity discriminator -> entity.Discriminator.StartsWith discriminator),
60+
/// (function
61+
/// | t when Type.(=)(t, typeof<Cat>) -> "cat+v1"
62+
/// | t when Type.(=)(t, typeof<Dog>) -> "dog+v1")
63+
/// )
64+
/// )
65+
/// </code></example>
66+
/// <example id="item-2"><code lang="fsharp">
67+
/// // discriminator equals
68+
/// let result () =
69+
/// queryable.Apply(
70+
/// filter,
71+
/// ObjectListFilterLinqOptions (
72+
/// (fun entity -> entity.Discriminator),
73+
/// (function
74+
/// | t when Type.(=)(t, typeof<Cat>) -> "cat"
75+
/// | t when Type.(=)(t, typeof<Dog>) -> "dog")
76+
/// )
77+
/// )
78+
/// </code></example>
5779
type ObjectListFilterLinqOptions<'T, 'D>
5880
(
5981
[<Optional>] compareDiscriminator : CompareDiscriminatorExpression<'T, 'D> | null,

src/FSharp.Data.GraphQL.Server.Middleware/ObjectListFilterModule.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ module ObjectListFilter =
6666
let ( @=@~ ) fname (value : string) = Contains ({ FieldName = fname; Value = value }, StringComparer.CurrentCultureIgnoreCase)
6767

6868
let private genericWhereMethod =
69-
let queryableType = typeof<Queryable>
70-
queryableType.GetMethods ()
69+
typeof<Queryable>.GetMethods ()
7170
|> Seq.where (fun m -> m.Name = "Where")
7271
|> Seq.find (fun m ->
7372
let parameters = m.GetParameters ()

0 commit comments

Comments
 (0)