I was developing an application using Entity Framework and storing data in a .mdf database. My code can read the data, apparently it can save too, but only apparently. It ge
A few things leap to mind:
Also - I don't think it'll matter in this case, but to verify data you should use a different entities/data-context:
using (DatabaseEntities e = new DatabaseEntities()) {
for (int i = 0; i < 50; i++) {
User u = new User();
u.Nome = "User" + i.ToString();
e.AddToUser(u);
}
int c = e.SaveChanges(true);
}
using (DatabaseEntities e = new DatabaseEntities()) {
List us = e.User.Where(x => x.ID < 50).ToList();
foreach (User u in us)
Console.WriteLine("ID: " + u.ID + " Hello from " + u.Nome);
}
Console.ReadKey();
Like I said - I doubt it'll matter here, but worth checking...