the call to context.Entry<Order>(updateorder)
attaches the object to EF.
why the detached entity is modified successfully in entity framework 5?
-
18-03-2022 - |
Frage
my code is .
class Program
{
static NorthwindEntities context = new NorthwindEntities();
static void Main(string[] args)
{
Order updateorder = new Order() { OrderID = 10256, ShipCountry = "444", ShipCity = "tehran" };
update(updateorder);
}
static public void update(Order updateorder)
{
context.Entry<Order>(updateorder ).State = EntityState.Modified;
context.SaveChanges();
}
}
please help me , i confused why the detached entity is modified in database
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow