문제

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

도움이 되었습니까?

해결책

the call to context.Entry<Order>(updateorder) attaches the object to EF.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top