Reputation: 537
I am not sure if there is a way to update edmx file automatically when database is changed.
If not, is there a method like UpdateModelFromDatabase I can use when I insert something into the database.
If not either, how to handle this situation by using edmx: a user reset his password and need log in again with his new password?
thanks
Upvotes: 1
Views: 874
Reputation: 4520
Ok, I just understood your question. Just so things are clear: UpdateModelFromDatabase
updates the structure of your DB into your EDMX schema. This has nothing to do with the DATA that is in the tables.
If you want to update the data, then it depends wether you use a repository or not. I assume you don't. So to update your context (which updates your data), juste recreate it before every query!
Example:
Connected listOfConnecteds
using (var context = AccesData.GetNewContext())
{
connected = context.Connected
.FirstOrDefault(c => c.IsActive)
.ToList();
if (connected != null)
{
connected.IsActive = false;
context.SaveChanges();
}
}
EDIT: It's context.SaveChanges();
, my bad
Upvotes: 1