WCF 데이터 서비스를 사용하기 위해 ASP.NET 웹 응용 프로그램을 만들고 http://services.odata.org/Northwind/Northwind.svc에 서비스 참조를 추가했습니다. 웹 페이지 (.aspx)를 만들고 GridView 및 Button 컨트롤을 추가하십시오.오류 "엔터티 또는 복합 형식을 추적하려고 시도했습니다."
이An attempt to track an entity or complex type failed because the entity or complex type 'NorthwindSvcRef.Customer' does not implement the INotifyPropertyChanged interface.
이 사람이 나를 도와 드릴까요 : 나는 위의 코드를 실행하면
protected void Button1_Click(object sender, EventArgs e)
{
var o = new NorthwindSvcRef.NorthwindEntities(new Uri("http://services.odata.org/Northwind/Northwind.svc"));
//The following works fine
//------------------------
//var q = o.Customers.Where(c => c.City == "London").ToList();
//GridView1.DataSource = q;
//GridView1.DataBind();
//Following does not work
//-----------------------
var q = o.Customers
.Where(c => c.City == "London")
.Select(c => c);
DataServiceCollection<Customer> oCustomers = new DataServiceCollection<Customer>(q);
GridView1.DataSource = oCustomers;
GridView1.DataBind();
}
, 나는 다음과 같은 오류가 발생하고있다 :
다음 코드를 쓴?
어떤 버전의 WCF Data Services를 사용합니까? 즉, DataServiceCollection에는 데이터 바인딩 인터페이스 = INotifyPropertyChanged를 구현하기 위해 제공하는 엔터티가 필요합니다. 서비스 참조 추가는이를 처리해야하지만 특정 버전 만 올바르게 처리 할 수 있습니다. –
Visual Studio 2010 Ultimate (대상 프레임 워크 4.0 사용) – user203687