class Profile { string name; Book[] books}
class Book { string name }
Two separate Profiles (A and B) both have a relation to the same book.
When I load the profiles one by one from Silverlight using WCF/RIA. I end up with two book object, with the same name. (same book!). I want RIA to detect that the book is already present in silverlight and use the existing instance instead of creating it a second time.
They are POCO (complex object-not in DB).
How do I tell RIA that the Name is unique and that there can not be two instances in Silverlight(RIA client side) with the same name?
UPDATE Since asking I have implemented a WORKAROUND - I dont not really consider it a elegant solution though! But here it is: The callback method on GetProfile is replaced with a method that traverses all profile.books and check if each book already exist in a local Dictionary. If the book exists locally the local book is used and the second instance is deleted. If it doesn't the book is added to the dictionary and used.
SOLUTION I create my own Book-class clientside, then convert the RIA-created bookss to my own book-type. When I send the updated Books back to the server, I create instances of RIA Books, and before updating any properties I call OnDeserializing() and OnDesriallized() after. That allows me to edit the RIA-Book.