RE: Linq SubmitChanges and DataLoadOptions
- From: v-wywang@xxxxxxxxxxxxxxxxxxxx ("Wen Yuan Wang [MSFT]")
- Date: Fri, 04 Apr 2008 04:11:47 GMT
Hello Chuck,
Thanks for your reply.
If you have set Auto-Sync on the columns, LINQ to SQL will fetch them back
after UpdateChanges() method. For Identity Columns or Calculated Columns,
those columns will be set as "Auto-Sync" in LINQ to SQL. Please check
"Auto-Sync" property on columns in .dbml file. You will found the reason
why LINQ to SQL retrieve Identity Columns in UpdateChanges() method. If you
have columns that are also generated at the database, set Auto-Sync on
those columns and LINQ to SQL will fetch them back. Moreover, when tracing
query on SQL server, you can found the generated select query only fetch
the related column from database, rather than fetch the whole row from
database. Thus, child rows aren't loaded from database.
In general, updating Master Table shouldn't clear the Detailed records. How
did you edit the master records? I tried the code which you pasted in
thread on my side. It seems fine. HasLoadedOrAssignedValues property
returns True after I Submitted Changes to database.
using (DataClasses1DataContext dc = new DataClasses1DataContext())
{
dc.Log = Console.Out;
DataLoadOptions lo = new DataLoadOptions();
lo.LoadWith<Table_1>(s => s.Table_11s);
dc.LoadOptions = lo;
var query = from obj in dc.Table_1s
where obj.c1 == 2
select obj;
Table_1 job = query.Single();
job.c2 = "10";
dc.SubmitChanges();
System.Console.WriteLine(job.Table_11s.HasLoadedOrAssignedValues);
}
Am I missing anything here? Please don't hesitate to correct me. I will try
again on my side. We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- References:
- Linq SubmitChanges and DataLoadOptions
- From: Chuck P
- RE: Linq SubmitChanges and DataLoadOptions
- From: "Wen Yuan Wang [MSFT]"
- RE: Linq SubmitChanges and DataLoadOptions
- From: Chuck P
- RE: Linq SubmitChanges and DataLoadOptions
- From: "Wen Yuan Wang [MSFT]"
- RE: Linq SubmitChanges and DataLoadOptions
- From: Chuck P
- Linq SubmitChanges and DataLoadOptions
- Prev by Date: Q: dynamically created databound controls persist but static controls don't
- Next by Date: Re: Linq SubmitChanges and DataLoadOptions
- Previous by thread: RE: Linq SubmitChanges and DataLoadOptions
- Next by thread: Re: Linq SubmitChanges and DataLoadOptions
- Index(es):
Relevant Pages
|