This question is locked. New answers and comments are not allowed.
Hi,
Just want to see what the best approach would be for the flowing scenario:
I Have a table ListSelections and a table ListSelectionColumns in SQL Server 2008. Of course the last table has a Foreign key to the first table. In this scenario there is always 1 ListSelection record that can have 1 or more ListSelectionColumn records.
Both tables have a primary key with an autonumber.
When implementing this in a model, i want to create a new ListSelectionEntity with 3 new ListSelectionColumnEntities:
This code generates all the records, 1 ListSelection and 3 ListSelectionColumns records, but the link between them is wrong. The value of the child records, the foreign key, is NULL in stead of the new assigned autonumber from the listSelection.
I discovered this because I used code from august 2010, that errored out; I know it did work in august. Now, instead, I save the ListSelectionEntity first, and than assign the new id to the child objects.
I provided a sample project (web app) using Q1 2011, latest build:
https://www.proovit.com/Download/Telerik/Telerik.TestEntityOne2anySaveWebApp1.zip
So, what would be the right approach for this? I was expecting that OA did update the foreign key.
Ok, thanks in advance,
Erik
Just want to see what the best approach would be for the flowing scenario:
I Have a table ListSelections and a table ListSelectionColumns in SQL Server 2008. Of course the last table has a Foreign key to the first table. In this scenario there is always 1 ListSelection record that can have 1 or more ListSelectionColumn records.
Both tables have a primary key with an autonumber.
When implementing this in a model, i want to create a new ListSelectionEntity with 3 new ListSelectionColumnEntities:
Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click Using DC As New EntitiesModel Dim lse As New ListSelectionEntity lse.Name = TextBox1.Text lse.Description = "@: " & Format(Now, "yyyy-MM-dd HH:mm:ss") For i = 1 To 3 Dim lsce As New ListSelectionColumnEntity lsce.Name = TextBox1.Text & " - Col " & i.ToString lsce.Remarks = "@: " & Format(Now, "yyyy-MM-dd HH:mm:ss") lse.ListSelectionColumnEntities.Add(lsce) Next DC.Add(lse) DC.SaveChanges() End UsingEnd SubI discovered this because I used code from august 2010, that errored out; I know it did work in august. Now, instead, I save the ListSelectionEntity first, and than assign the new id to the child objects.
I provided a sample project (web app) using Q1 2011, latest build:
https://www.proovit.com/Download/Telerik/Telerik.TestEntityOne2anySaveWebApp1.zip
So, what would be the right approach for this? I was expecting that OA did update the foreign key.
Ok, thanks in advance,
Erik