Changes Beta 1 > Beta 2 - GetQueryText and GetChangeText Commands?
-
Saturday, July 28, 2007 8:08 PM
Hi NG,
Is there any documentation about the changes between beta 1 and beta 2?
I'm looking for the GetQueryText and GetChangeText Commands... But they are no more under DataContext class.
Thx for your help,
Ozgur Aytekin
All Replies
-
Sunday, July 29, 2007 1:37 AMI could use a feature comparison. The "Custom Attributes" no longer appears in the properties for O/R designer. So how do we add custom attributes now?
-
Sunday, July 29, 2007 11:19 AM
Hi
You can add Custom Attributes to partial classes. Just as a quick POC, I added the Obsolete tag to Order and Visual Studio picked it up.
Code Snippet[
Obsolete] partial class Order{
public int MyOrderID(){
return this.OrderID;}
}
Having Custom Attributes in partial classes makes more sense to me as its your own logic and not LINQ. Plus, regenerating the code would be easier as you wouldn't have to worry about what attributes to attach.
Ben
-
Monday, July 30, 2007 1:32 AMDownside to the partial class implementation is that it doesn't allow for adding attributes for the column properties. A couple typical examples where this would be useful would be marking properties as DataMembers in a WCF DataContext. Also, the EntLib ValidationBlock uses attributes on the properties for the property validation.
Jim Wooley
-
Monday, July 30, 2007 1:38 AM
I have it working with WCF.
I actually did it the "hard" way. I coppied the O/R generated class and just capped all the properties. Not real pretty but it works.
Larry
-
Monday, July 30, 2007 5:52 AM
Last week I posted a list of new LINQ to SQL features in beta2 on my blog. I am working on updating the LINQ to SQL paper available on MSDN.
Specifically
1. GetQueryText() is superseded by GetCommand() which gives you the SqlCommand. This allows programmatic access in addition to getting the text.
2. GetChangeText() is superseded by GetChangeSet() which gives you access to the the set of changed objects. Again this allows programmatic manipulation including complete takeover of SQL command generation or additional/alternate actions.
Please note that DataContext.Log is still available if all you want to do is to log the generated SQL. The combination of the three features allows much more power than the previous set of methods.
Thanks for your patience.
Dinesh Kulkarni -
Sunday, August 05, 2007 6:50 PM
Having access to GetChangeText was benificial in demo apps as it allowed us to easily view the SQL that would be used without having to call the SubmitChanges on the context itself. Beta 2 still allows us to access it via reflecting on the private member, but I don't want to have to resort to that option if possible.
Along this line, is there any consideration being given to make the ChangeSet Serializable? That would allow us to manage the change tracking list and then just send the changes back to the app server.
Jim Wooley
-
Wednesday, August 08, 2007 6:14 PM
Dear Jim,
Can you tell me the private member name for the INSERT, UPDATE and DELETE commands?
Thx
Ozgur
-
Friday, August 10, 2007 2:26 AM
DataContext.GetChangeText is now private (unless you know reflection).

