What is the expected behavior when an Id does not exist using SingleById?
var account = Db.SingleById<Account>(username);
I was expecting null but it’s returning an Account even if the Id does not exist…
I’m currently using 6.1.0
In my db, the Account.Id is an int.
But in the above example, I passed a username (a string) by mistake and was surprised to see OrmLite returned a value…
If it can help I tried the following:
var accounts = db.Select<Account>(x => x.Id == username);
var account = Db.SingleById<Account>(username);
accounts is empty but the next statement return an existing account…
If I use an int and an Id that does not exist SingleById returns null for account which is what I would expect.
The db is MySql