Reputation: 127
I have a problem
I have a table with 44839 records
But when I try to load my table through EF with this code:
dbContext = new MyDbContext("MyContext");
dbContext.SalesRegister.Load();
BindingList<SalesRegister> db =dbContext.SalesRegister.Local.ToBindingList();
gridControl.DataSource = db;
bsiRecordsCount.Caption = "RECORDS : " + db.Count;
I only get 16311 records
But when I use this I get all my records
dbContext = new MyDbContext("MyContext");
List<SaleRegister> db = dbContext.SalesRegister.SqlQuery("select * from vwSalesRegister").ToList();
gridControl.DataSource = db;
bsiRecordsCount.Caption = "RECORDS : " + db.Count;
Why is this happening??
Upvotes: 5
Views: 205
Reputation: 127
And the solution for this was really simple!! Make sure to define the PK on both sides (code & database). Thanks to @IvanStoev
Upvotes: 2