Say I have two classes and have a requirement that the primary key property must be named "Id" (example: Book and Publisher). The requirement is because I'm working with our companies code generated objects and can't change the way they are generated. These classes have a a foreign key between them: Book to Publisher and is a one to one relationship, where in this case, each Book only has one Publisher.
In order to use Book.Publisher as a property in .Net RIA Services, you need to add the attributes.
For example in the meta data for the Book class:
[Key]
public int Id;
...
[Include]
[Association("Book_Publisher", "Id", "Id", IsForeignKey = true)]
public Publisher Publisher;
In the meta data for the publisher class:
[Key]
public int Id;
...
In the client code I attempt to get the Publisher: Publisher booksPublisher = Book.Publisher; But I get the wrong publisher (or a null). After looking at the database, the Publisher id is it looking for is the id of the book, not the publisher.
Can I add an alias in the meta data? Will later versions of RIA Services handle this?
Thank you.