Dear Telerik Team,
I try to do something that initialy seemed to be piece of cake, but in the end I was fighting for hours with this problem without too much success. Maybe the solution is simple indeed but I fail to see it, so please help me with this.
I wanted to experiment with something before I go deep in my project.
I have a very simple test database including three tables
TableA
- Id, int, primary key, autoincrement
- Name varchar(50)
TableB
- Id, int, primary key, autoincrement
-Name varchar(50)
TableAB - establishing many-to-many relations between the two tables above.
-Id, int, primary key, autoincrement
-IdA, int, foreign key in TableA
-IdB, int, foreign key in TableB
I created a DomainModel with the three tables, the associations are done automatically based on relations I have established in database.
I created an OpenAccessDomainService selecting all entities and Edit capabilities for this model.
From a Silverlight client with RIA enabled I can insert new TableA and TableB entities, I can also insert directly TableAB entities in respective entity set if I use already submitted TableA & TableB entities, these would have Ids.
Now I was expecting that I can add relations between new entities similarily with the model supported by Linq2Sql, where on the relation entity you can just put the references to the newly created entities, event if they do not have yet the Ids allocated form database, Linq2sql will serialize the inserts and will update dinamically the Ids such way that the relation will be saved correctly with the newly allocated Foreign Keys.
Unfortunately this experinece did not repeated in my initiative to use RIA + OpenAccess.
On the server I have correctly generated for example
public partial class TableAB
{
public virtual int IdA { get; set; }
public virtual int IdB { get; set; }
public virtual int Id { get; set; }
public virtual TableA TableA { get; set; }
public virtual TableB TableB { get; set; }
}
on the client, in Web.g.cs file The TableAB entity will not have entity properties, but only the int keys, Id, IdA and IdB so I cannot define the relation by specifying newly created TableA and newly created TableB because on the client only the id's of related entities are expected.
Now based on the googling I did in the last good hours I understood that it may be possible somehow to specify some attributes in server metadataclasses to force RIA to include these properties too, but I also read that these will go only from the server to client , and they will be always null when posted back to server.
Any ideea on solving this is appreciated.
Thank you,
Vasile