2010-12-16 1 views
0

안녕하세요, 도메인 서비스, 엔터티 프레임 워크 및 asp.net을 사용하여 레코드를 업데이트하는 데 문제가 있습니다.Me.ChangeSet.GetOriginal, 개체 참조가 개체의 인스턴스로 설정되지 않았습니다.

Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. 

Source Error: 


Line 257:   } 
Line 258:  Me.ObjectContext.OrderStatusHistories.AddObject(_orderStatusHistory) 
Line 259:  Me.ObjectContext.Orders.AttachAsModified(currentOrder, Me.ChangeSet.GetOriginal(currentOrder)) 
Line 260: End Sub 
Line 261: 

주문이 데이터베이스에서 이루어 지므로 여기에 무슨 일이 일어나는 지 알고 있습니까?

+0

분명히 객체 중 하나가 null 참조를 가지고 있습니다. 디버깅을 시도 했습니까 ?? – RPM1984

+0

더 많은 코드를 보여야합니다. 어떤 줄에 오류가 발생합니다. 액세스하려고하는 개체 중 하나가 설정되어 있지 않음 (Nothing) 오류가 표시됩니다. 디버거로 확인할 수 있습니다. – Jan

답변

0

변경 집합이 null이었습니다. 그래서 내 코드에서 changeset가 null이 아니라면, 나는 changeset가 없다면 코드를 실행할 필요가 없다.