css
xml
ajax
python
mysql
database
regex
objective-c
visual-studio
silverlight
flash
html5
perl
facebook
cocoa
tsql
php5
asp
jsp
dom
The problem is you have 2 different sets of sets - one for Customers and one for ResidentialCustomer.
The problem from the model perspective is that given a user instance that belongs to Users set, which set does the navigation property 'Customer' refer to - it can refer to customer set from Customers or ResidentialCustomer.
The question is why do you want to have 2 sets for customers and residential customers? If you want to access residentialCustomers from customers set, you can always query /Customers/Namespace.ResidentialCustomer and that will give you all the residential customers from the Customers set.
If you really want to have 2 different sets for customer and residentialcustomer, then have a base class (CustomerBase) which has all the common properties between the 2 types and then define Users navigation property on both Customer and ResidentialCustomer, with different association set.
Hope this helps.
Upon further testing, it seems like there are currently two severe constraints on the metadata in order to expose it with a custom (or any?) OData Service Provider:
OData
1) A ResourceType cannot extend another ResourceType (the BaseType for a ResourceType must be null). To some extent, this constraint can be alleviated by replicating all properties of the base type into the extended type in the metadata.
ResourceType
BaseType
2) A ResourceType or ResourceSet cannot be involved in an association, if its InstanceType extends another InstanceType referred to in the metadata, regardless of how the ResourceTypes for each instance type are set up. In other words in the example, if ResidentialCustomer extends Customer in the CLR model, I can't use a ResourceType or ResourceSet with an InstanceType of ResidentialCustomer in any association. I don't know of any workaround to this, other than not providing these necessary associations via the OData Service Provider.
ResourceSet
InstanceType
ResidentialCustomer
Customer
If I violate any of the above 2 constraints, I get a null reference exception in the .net library class method ResourceAssociationSet.GetResourceAssociationSetEnd().
ResourceAssociationSet.GetResourceAssociationSetEnd()
Are these constraints correct, or are there any examples to workaround these constraints or properly set up the metadata for these scenarios?