views:

358

answers:

1

I’m using Silverlight and the .NET RIA Services.

I’ve generated an entity data model from a database, created one domain class service for all the tables and chosen to generate the metadata.

Now, when trying to build I get errors in metadata that contain foreign keys in the generated file App.Web.g.cs. The problem is there are lots of evaluations comparing Entities to simple values. For example, Order.Customer is a foreign key for Customer.ID and the following fails:

private bool FilterOrder(Order entity) { return (entity.Customer == this.ID); }

I would expect to see:

private bool FilterOrder(Order entity) { return (entity.Customer.ID == this.ID); }

I don’t really know what to do here as the problem is in a generated file. Any help would be appreciated.

Thanks

A: 

I think you have to explicitly create the foreign key as a Scalar Property of your Order entity and then mark it as the Dependent Property in the Referential Constraint on the Orders-Customer association (double-click the association in the EF designer).

Arnold Schrijver
PS. I mean creating a property like 'Order.CustomerId'
Arnold Schrijver