简体   繁体   English

实体框架DbSet包含0条记录

[英]Entity Framework DbSet contains 0 records

So I have the following problem: 所以我有以下问题:

I have some Vehicle entity that corresponds to a table in the DB. 我有一些对应于数据库表的Vehicle实体。 But when I try to retrieve ALL the records with the following line : 但是,当我尝试使用以下行检索所有记录时:

var vehicles = db.VehicleSet.ToList();

I get ZERO objects as result ... whilst the table in the DB has approx. 结果得到零对象...而数据库中的表大约有 18k records. 18k记录。

Any idea where the problem might be, or is the question too vague? 知道问题可能在哪里,还是问题太模糊?

I Figured it out. 我想到了。 Turns out it was a problem with the Database. 原来这是数据库的问题。 In my structure I was using a "Discriminator" field which was not set and was causing problems. 在我的结构中,我使用的是“ Discriminator”字段,该字段未设置并导致问题。

Thank you for your time. 感谢您的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM