Hello everyone!
It could be the question about Entity Framework (WCF RIA domain model is based on it) but I'm not sure...
So I have Silverlight UI (MVVM) + WCF RIA domain services + Entity Framework on server side.
I have data Entities: Room -> Hotel (parent entity) <- RoomTypes plus Room has a reference to room type (so Room can be e.g. Single or Twin or Double etc). And one Hotel contains a set of Room Types used in this hotel.
Problem - on UI side I created user control - Room editor. There is I have text boxes (there is no any problem with text boxes and data binding) and also there is I have comboBox - to edit Room Type of Room. I can't figure out what is correct way to work this way... Please help me with it!
What I have now - I tried to load Hotels with Room types (in domain metadata - via [Include] attribute and plus this.ObjectContext.Hotels.Include("RoomTypes") in WCF RIA server side domain class) and in comboBox bind it to the room types list. But! If i choose some room type where was an exception - "Entity 'RoomType' cannot be attached to this EntityContainer because it is already attached to another EntityContainer."... Hotel is loaded by separate domain service and room types (in the User Control) is loaded by own domain service. How can I solve it?
Thanks in advance!