tags:

views:

282

answers:

1

I need to create a db structure where "Supplier" inherits from "Client". I used to have an association on Client that I want to move to Supplier, but I can figure out how to define this. IN VS When I add an association to Supplier I can only associate the fields explicitly defined in Supplier (And I need to associate Client.Id).

Can I use the workaround where I add ClientId in Supplier?

+1  A: 

(updated)

Right; I see what you mean. I suspect that with LINQ-to-SQL you can only associate to the base-class, and it will give you the appropriate types. You can filter with OfType<T> etc.

You can't simply add the id to the derived class, as it needs to be resolvable by LINQ when examining query expressions - and a bespoke standalone property won't be.

However, I also recall that this is possible in EF (even if I don't like EF overly ;-p).

Marc Gravell