Closed kirse closed 2 years ago
This has been fixed in v6.0.6
The only caveat is that a composite key has to be an obj[]
or obj list
, so you'd need to use the second option above
tryFindEntity<CompositeKeyEntity> db (fun (x : CompositeKeyEntity) ->
let key : obj[] = [| x.Key1; x.Key2; x.KeyN |]
key)
Awesome, thanks, love the project and using it daily!
Thank you, it's always great to hear when someone is getting some use out of it
On rev-ing to 6.0.6 it appears the DbContextHelpers.fs
methods now return everything of type obj
instead of 'a
, is this intended?
Ex:
let myBlog = tryFindEntity<Blog> db id
// type of myBlog is now obj instead of Blog
I think this breaks a lot of the docs here as well: https://efcore.github.io/EFCore.FSharp//How_Tos/Use_DbContextHelpers.html
@simon-reynolds Any insight, should I create a separate issue?
General setup:
Then try:
Or this:
Which causes this:
Not hugely impactful since
.Find()
can be used directly, but treatingkey
asobj
instead ofobj[]
means composite keys can't be used with the helper functions (and they are helpful in many cases).