FindAsync with non-primary key value

前端 未结 1 1003
忘了有多久
忘了有多久 2021-02-07 03:30
public class Foo
{
     public int Id { get; set; }
     public int UserId { get; set; }
}

This appears to be the way to do this asynchronously:

<
1条回答
  •  孤街浪徒
    2021-02-07 04:03

    Assuming you are using Entity Framework 6.0 (prerelease):

    var userId = ...;
    var foos = await db.Foos.Where(x => x.UserId == userId).ToListAsync();
    

    0 讨论(0)
提交回复
热议问题