entity-framework - 我想从实体框架中检索所有客户端,但它返回 0 尽管我在表中有记录
问题描述
我的问题如下:
在 ApplicationDbContext 中我有一个 DbSet 客户端,在 dbo 表中我有 5 条记录。当我尝试进行一些 linQ 查询时,尽管我有 5 条记录,但它检索到 0 条记录。我想我在课堂上错过了一些 IEnumerable 吗?
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public DbSet<Carer> Carers { get; set; }
public DbSet<Appointment> Appointments { get; set; }
public DbSet<Client> Clients { get; set; }
}
public class Client
{
[Key]
public int IdClient { get; set; }
public string FullName { get; set; }
public string FullAdress { get; set; }
public string PostCode { get; set; }
public string PhoneNumber { get; set; }
}
var xx = _Context.Clients; // this returns 0 records
解决方案
推荐阅读
- java - 屏障组件在 Spring 集成中如何工作?
- java - “构造函数语句”和“声明语句”是描述这些语句的正确名称吗?
- parameters - 处理类和实例问题
- javascript - jQuery popover 在 Django 应用程序中不起作用?
- reactjs - 在 http-proxy-middleware 的 setupProxy.js 中反应导入环境生成意外标识符
- php - 如何根据当前登录用户codeigniter获取/检索数据,但外键连接到另一个外键
- c# - 在 Unity 中应用多个旋转
- mysql - 参数化查询 - M 语言 (Excel)
- reactjs - 有没有办法为 ReactJs 中的 material-ui 组件提供全局类?
- azure - 从 Azure 数据工厂中的 API 获取而不复制 URL