Updating in linq to sql

Below is a diagram showing the execution architecture of LINQ to SQL.

The rules for executing a query with LINQ to SQL is similiar to that of a standard LINQ query i.e. There are various components that play a role in execution of a query with LINQ to SQL and these are the following ones. Connection Strings("Linq To SQLDBConnection String"). To String() Dim db As New Linq To SQLData Context(connect String) Dim new Employee As New Employee() new Employee.

In Jeffrey’s article, he gave an example of ‘deleting all rows where creation date was older than a month’.

This is a perfect example of when a O/R Mapping framework issues multiple delete statements when a single ‘simple’ SQL statement could be written.

A couple weeks ago, I read the article, LINQ to SQL Extension: Batch Deletion with Lambda Expression by Jeffrey Zhao.

In case you didn’t read the article, it discusses the downside of most O/R Mapping frameworks when it comes to multiple updates or deletes.

sorry im not sure about your conversion problem, but you dont have to convert the code to to make it work for VB. Just download the code, compile and add the DLL file as a reference to your project, then follow the article on how to use BUT use VB. Not sure if i like the overuse of reflection (your update method sorta goes against the grain as far as L2S goes, but that's ok...) Firstly, your update method shouldn't be instantiating a new datacontext - that should be handled outside of there.

updating in linq to sql-12

Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.

One last thing with the Update method again, is that if you're going to keep it the same, it might help to again use the attributes marked in the L2S classes. So , you are breaking all the freedom to change easily your DAL to one or other object...

Again, you can search for properties marked with Column Attribute so you know which fields to copy across, instead of checking to see if they're System. basically , you can not unit test this code, adpated it in N-tiers applications or a MVC architecture Secondly, you should have a look to the extensions method...

Since I recently converted my site to blogengine.net, I’ll use its database schema for all examples to follow.

In addition to this, all code snippets you’ll see were run in LINQPad, which at the moment is by far my favorite development tool that I’m using (now if they’d only get intellisense in there, I’d play with this program all day long).

Leave a Reply