Using Entity Framework 4.1 with SQL Server 2008 R2 Express.
I have a strongly typed DbContext (ctx in code) with IDbSet<Users> property which represents a table [Users] in the database.
When I execute:
var result = ctx.Users.ToList();
The result.Count is 0 as if there is nothing in the database although there are records in that table. I’ve checked the ctx.Database.Connection and it does have the right connection string.
I executed
ctx.Users.ToString()
to get the SQL that will be executed and when I execute the given statement in the SQL management studio I do get the list of users.
It seems as if the query is never executed and I am unable to detemine what could be the problem.
Everything is fine. It did not read the correct connection string and it created an empty database instead :). Thx everybody for the effort