Fixed code error in EF Core post

Compiler did not flag an error I had made, until it did...
This commit is contained in:
Daniel J. Summers 2018-07-08 22:12:08 -05:00
parent 862bfb523a
commit 834e542bc3

View File

@ -25,15 +25,15 @@ module Conversion =
open System open System
open System.Linq.Expressions open System.Linq.Expressions
let asLinqExpr<'T> = (LeafExpressionConverter.QuotationToExpression >> unbox<Expression<Func<'T, 'T option>>>)
let toOption<'T> = let toOption<'T> =
<@ Func<'T, 'T option>(fun (x : 'T) -> match box x with null -> None | _ -> Some x) @> <@ Func<'T, 'T option>(fun (x : 'T) -> match box x with null -> None | _ -> Some x) @>
|> asLinqExpr |> LeafExpressionConverter.QuotationToExpression
|> unbox<Expression<Func<'T, 'T option>>>
let fromOption<'T> = let fromOption<'T> =
<@ Func<'T option, 'T>(fun (x : 'T option) -> match x with Some y -> y | None -> Unchecked.defaultof<'T>) @> <@ Func<'T option, 'T>(fun (x : 'T option) -> match x with Some y -> y | None -> Unchecked.defaultof<'T>) @>
|> asLinqExpr |> LeafExpressionConverter.QuotationToExpression
|> unbox<Expression<Func<'T option, 'T>>>
type OptionConverter<'T> () = type OptionConverter<'T> () =
inherit ValueConverter<'T option, 'T> (Conversion.fromOption, Conversion.toOption) inherit ValueConverter<'T option, 'T> (Conversion.fromOption, Conversion.toOption)