JordanMarr / SqlHydra

SqlHydra is a suite of NuGet packages for working with databases in F# including code generation tools and query expressions.
MIT License
223 stars 22 forks source link

support implicit .NET conversions on option types #41

Closed ieviev closed 1 year ago

ieviev commented 1 year ago

currently the LINQ expression visitor runs into an exception when dealing with implicit numeric conversions.

since both of the following examples are valid F# i added support for these implicit conversions

// runs just fine
let query1 = 
    selectAsync HydraReader.Read (Create openContext) {
        for c in Sqlite.QueryUnitTests.errorLogTable do
        where (c.ErrorSeverity = Some 1L)
    }
// runs into an exception    
let query2 = 
    selectAsync HydraReader.Read (Create openContext) {
        for c in Sqlite.QueryUnitTests.errorLogTable do
        where (c.ErrorSeverity = Some 1)
    }
JordanMarr commented 1 year ago

I have definitely run into this problem before with implicit conversions. Thanks for fixing it!!

JordanMarr commented 1 year ago

Merged and release as SqlHydra.Query v1.0.5. Thank you! (I also added support for non-option types and implicit calls that are not upcasts, like int to decimal!)

ieviev commented 1 year ago

@JordanMarr Great! Thank you for updating it so quickly