Reputation: 3982
In C# and Sqllite I am using this to retrieve an object from it's primary key (the object property Id
is marked [PrimaryKey]
)
return Connection.Table<MyObj>().Where(o => o.Id.Equals(idToFind)).First();
Seems a bit verbose. Is there an easier way to retrieve the object?
Upvotes: 1
Views: 192
Reputation: 39976
You can use the Find
method:
Connection.Table<MyObj>().Find(idToFind);
Upvotes: 2