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
lang-ml