LINQ to SQL Beta 2 to RTM Changes

22 11 2007

vs08_v_rgb_web.jpg

I was totally shocked to see when my solution which I had built using Orcas Beta 2 threw errors when compiled in VS 2008 RTM!

Exploring a bit, I found that the errors generated were related to my LINQ-to-SQL classes.

Error 8 ‘System.Data.Linq.Table<Gandalf.DataAccess.Course>’ does not contain a definition for ‘Add’ and no extension method ‘Add’ accepting a first argument of type ‘System.Data.Linq.Table<Gandalf.DataAccess.Course>’ could be found (are you missing a using directive or an assembly reference?) E:\Masters Project\Entirely New\Gandalf\Source\Business Logic\Gandalf.BusinessLogic\EduTutor.cs 257 33 Gandalf.BusinessLogic

Wherever I had the “Add” method, I had error. I even created a new project and did the same thing – tried to add records to the database but couldn’t get the “Add” method.

Searching in MSDN forums, I found this šŸ™‚

Here are the changes,

Previous Method
(Beta1 and Beta2)
Renamed Method
(VS 2008 RTM)
Add() InsertOnSubmit()
AddAll() InsertAllOnSubmit()
Remove() DeleteOnSubmit()
RemoveAll() DeleteAllOnSubmit()

The reason given by Dinesh Kulkarni, who is the current Program Manager of LINQ to SQL is acceptable,

The original goal was to use existing Add()/Remove() pattern on collections. The problem was that the semantics is quite different – it is not like an Add()/Remove() on collection. The intent and the action is INSERT and DELETE database operations and those too only upon SubmitChanges(). This caused significant confusion on two fronts:

1. I want to INSERT or DELETE, how do I do it? Database folks kept looking for API methods with similar names

2. Why is this collection method not behaving just like a normal IList.Add()/Remove()?

Now its clear why I got those errors šŸ˜‰

Advertisements

Actions

Information

4 responses

28 11 2007
Pavan Kulkarni

Thanks for the info! Was looking for this!

16 12 2007
P

Thanks for posting this. First hit on google with the answer.

21 01 2008
Jay

Big help!

22 04 2008
Yuvi

Was looking for this šŸ™‚ Thanks šŸ˜‰

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: