Friday, August 8, 2008

System.Data.Linq.Table: Beta 2 to RTM

If you've been following Microsoft technologies for a while, you probably noticed that when the technology goes into RTM, there are changes in method names and syntax (remember the exception handling syntax with SQL Server 2005 T-SQL in beta?). The same goes for LINQ.

When trying out code samples from the Beta 2 days, you'll probably want to note the following change to the method names of the System.Data.Linq.Table class:




The Add, AddAll, Remove and RemoveAll methods have been renamed to InsertOnSubmit, InsertAllOnSubmit, DeleteOnSubmit and DeleteAllOnSubmit, respectively. This is mostly because database developers look for methods with names that resemble the SQL statements (SELECT, INSERT, UPDATE, DELETE) and because these methods do not immediately add or remove the data from the table like you would expect if you've been working with collection types.

If you haven't updated your source code yet, you'll end up with the following compilation error:
System.Data.Linq.Table does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type System.Data.Linq.Table could be found (are you missing a using directive or an assembly reference?)

2 comments:

poop*ghost said...

THANK YOU! I was using scottgu's blog and it was using the beta stuff for delete.

indu said...

Thank you So much.I have been trying solve this problem from week .

PP