LINQ to SQL (Part 4 - Updating our Database)
page 11 of 12
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 31561/ 476

Summary

Hopefully the above post provides a good summary of how you can easily use LINQ to SQL to update your database, and cleanly integrate validation and business logic with your data models.  I think you'll find that LINQ to SQL can dramatically improve your productivity when working with data, and enable you to write extremely clean object-oriented data access code.

In upcoming blog posts in this series I'll cover the new <asp:linqdatasource> control coming in .NET 3.5, and talk about how you can easily build data UI in ASP.NET that takes advantage of LINQ to SQL data models. I'll also cover some more specific LINQ to SQL programming concepts including optimistic concurrency, lazy and eager loading, table mapping inheritance, custom SQL/SPROC usage, and more.

Hope this helps,

Scott


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 4 and 2 and type the answer here:

User Comments

Title: Bad advice   
Name: Simon
Date: 12/28/2008 11:59:06 PM
Comment:
The partial class validation logic you demonstrate is not testable and is therefore useless to me. Isn't it better advice to put the validation logic in business objects (as Rocky Lhotka would urge). Or alternatively, to put it in a service layer or repository that is testable. Baking your validation logic into these proprietary, tightly coupled, LINQ DTOs seems wrong.
Title: Create items together   
Name: Tom
Date: 12/24/2008 1:49:56 PM
Comment:
Is there a way to create a category and product together? From what I've seen, beverages.Products would be null, so you can't call "Add" on it. You also can't set Products equal to a new EntitySet, because the setter assumes a non-null EntitySet already which it calls "Assign" on.

Thanks!
Title: Very helpful   
Name: Alexander
Date: 11/13/2008 9:20:30 PM
Comment:
Just great. Killed a few days with msdn stuff trying to comprehend logic of Entity Insert/Update/Delete customisatiton. Just got it from this article in a couple of minutes.
Thank you.
Title: Linq doesn't update   
Name: Moez Tounsi
Date: 10/7/2008 12:15:53 PM
Comment:
Following the example above, ling will add a new record with the new parameters.
We have to handle the deletion of the old element.
Title: Excellent   
Name: Wayne
Date: 7/23/2008 12:27:59 AM
Comment:
Excellent article, Well done, a really good read.
Title: Thanks a lot   
Name: Andi
Date: 12/2/2007 11:25:10 AM
Comment:
Thank you for this great article!!!






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/21/2009 9:19:35 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search