3

I'm using the following Library in my project: https://github.com/praeclarum/sqlite-net
I looked through the documentation and I couldn't find a way of doing UpdateAsync or DeleteAsync with a WHERE clause. For example, in a Get method it looks like this:

await sqlConnection.Table<MyTable>().Where(v => v.Type.Equals(type)).ToListAsync().ContinueWith((t) => { ... }

However, with the UpdateAsync or DeleteAsync the Where method is not there. So far I've been using the Query and constructing the query by hand, but this is kind of pointless since I'm using an ORM for this purpose, and I'm talking about something as simple as an Update or Delete command. Any thoughts on this?

1 Answer 1

1

Maybe you can try something like this:

var ExistingUser = await db.FindAsync<User>(u => u.UserName == user.UserName);
if (ExistingUser != null)
{
    await db.UpdateAsync(user);
}

(Where UserName is the Primary Key of my User table.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.