LINQ to Entities exception [modified]
-
I have SL+WCF+EntityFramework project. Silverlight code: private void theDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { object selected = theDataGrid.SelectedItem; proxy.GetOrdersByCustomerAsync(selected as NorthwindService.Customers); proxy.GetOrdersByCustomerCompleted += new EventHandler (proxy_GetOrdersByCustomerCompleted); } void proxy_GetOrdersByCustomerCompleted(object sender, Europlan2.NorthwindService.GetOrdersByCustomerCompletedEventArgs e) { theDataGrid2.ItemsSource = e.Result; } WCF Code: [OperationContract] public List < CustomersOrder > GetOrdersByCustomer(Customers customer) { NORTHWNDEntities proxy = new NORTHWNDEntities(); var orders = from ord in proxy.Orders where ord.Customers.CustomerID == customer.CustomerID select new CustomersOrder(ord.Customers.ContactName, ord.ShipCity); return orders.ToList(); } It doesn`t work.Exception says only parameterless constructors allowed in LINQ to Entities.(((( So how can i return not List < Orders > but List < Of just some fields of Orders class > Besides DataGrid needs strongly typed objects to autogenerate columns. Thanks
modified on Saturday, June 20, 2009 2:37 AM