0

I have this entity (I left only relevant fields):

type UserSession = {
 Id: string
 CreatedAt: DateTime
 LastRefreshAt: DateTime option
}

and in my UserSessionRepository.fs I have this function:

member this.DeleteAbandoned (olderThen:DateTime) = 
 base.Delete (fun session -> 
 session.CreatedAt < olderThen &&
 // error: Value is not a property of UserSession
 (session.LastRefreshAt.IsNone || session.LastRefreshAt.Value < olderThen)
 )
 |> ignore

I get the error "Value is not defined as a property of UserSession" (kind of).

I changed it, trying to avoid using the .Value property:

member this.DeleteAbandoned (olderThen:DateTime) = 
 base.Delete (fun session -> 
 session.CreatedAt < olderThen &&
 // error: Object reference not set to an instance of an object
 (session.LastRefreshAt.IsNone || session.LastRefreshAt < Some(olderThen))
 )
 |> ignore

but this raises the error "Object reference not set to an instance of an object".

How to solve it?

RepoDB 10.x
.net 9

jonrsharpe
122k30 gold badges268 silver badges476 bronze badges
asked Mar 16 at 13:19

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.