public class Foo
{
public int Id { get; set; }
public int UserId { get; set; }
}
这似乎是异步执行此操作的方法:
DatabaseContext db = new DatabaseContext();
Foo foo = await db.Foos.FindAsync(fooid);
如何根据用户ID的值异步获取该用户的所有Foo?
public class Foo
{
public int Id { get; set; }
public int UserId { get; set; }
}
这似乎是异步执行此操作的方法:
DatabaseContext db = new DatabaseContext();
Foo foo = await db.Foos.FindAsync(fooid);
如何根据用户ID的值异步获取该用户的所有Foo?
假设您正在使用实体框架 6.0(预发布版):
var userId = ...;
var foos = await db.Foos.Where(x => x.UserId == userId).ToListAsync();