具有非主键值的FindAsync
public class Foo { public int Id { get; set; } public int UserId { get; set; } }
这似乎是异步执行此操作的方法:
DatabaseContext db = new DatabaseContext(); Foo foo = await db.Foos.FindAsync(fooid);
如何根据UserId的值异步获取特定用户的所有Foos?
假设您正在使用Entity Framework 6.0(预发行版):
var userId = ...; var foos = await db.Foos.Where(x => x.UserId == userId).ToListAsync();
- 使用asp.net webapi实现oData inlinecount
- ASP.Net Web Api – ApiExplorer不包含任何ApiDescriptions
- 使用C#.net在winform中调用和使用Web API
- WebApi2属性路由inheritance了控制器
- Xamarin.Forms:如何从Web API数据填充饼图?
- 将身份validation添加到ASP.NET WebApi 2.2
- 如何解析MultipartFormDataContent
- 多个可选的查询字符串参数REST API GET
- Castle Windsor ASP.NET MVC 4和Web API相同的应用程序。 只有MVC控制器没有依赖关系?