background preloader

LINQ to SQL

Facebook Twitter

LINQ to SQL: Basic Concepts and Features. Download source code - 58.9 KB Introduction In my first three articles on CodeProject, I explained the fundamentals of Windows Communication Foundation (WCF), including: Starting last month, I have started to write a few articles to explain LINQ, LINQ to SQL, Entity Framework, and LINQ to Entities. Followings are the articles I wrote or plan to write for LINQ, LINQ to SQL, and LINQ to Entities: Introducing LINQ—Language Integrated Query (last article) LINQ to SQL: Basic Concepts and Features (this article) LINQ to SQL: Advanced Concepts and Features (next article) LINQ to Entities: Basic Concepts and Features (future article) LINQ to Entities: Advanced Concepts and Features (future article) After finishing these five articles, I will come back to write some more articles on WCF from my real work experience, which will be definitely helpful to your real world work if you are using WCF right now.

Overview In the previous article, we learned a few new features of C# 3.0 for LINQ. LINQ to SQL. Using LINQ to SQL (Part 1) Over the last few months I wrote a series of blog posts that covered some of the new language features that are coming with the Visual Studio and .NET Framework "Orcas" release. Here are pointers to the posts in my series: The above language features help make querying data a first class programming concept. We call this overall querying programming model "LINQ" - which stands for .NET Language Integrated Query.

Developers can use LINQ with any data source. They can express efficient query behavior in their programming language of choice, optionally transform/shape data query results into whatever format they want, and then easily manipulate the results. LINQ-enabled languages can provide full type-safety and compile-time checking of query expressions, and development tools can provide full intellisense, debugging, and rich refactoring support when writing LINQ code.

What Is LINQ to SQL? LINQ to SQL fully supports transactions, views, and stored procedures. LINQ to SQL Code Examples Summary. LINQ to SQL details, issues and patterns. LINQ to SQL (formely called DLINQ) is a simple object-relational mapper (ORM) scheduled for .NET Framework 3.5/Visual Studio 2007 (Orcas). On projects with new data I’m keen on keeping the tables and classes as similar as possible and so the limited functionality of LINQ to SQL really appeals to me. Sure for larger applications or where legacy data does not inspire great classes then a more advanced ORM with better mapping facilities can outweigh the disadvantages and learning curve imposed by another layer of abstraction. Microsoft have that covered with LINQ to Entities which will ship post-Orcas because of the immaturity of the the designer and advanced scenarios.

Whilst prototyping I’ve come up with a few oddities that deserve documenting somewhere. Here they are in not-quite-FAQ format. What SQL is this query or operation generating? Set the Log property of your DataContext object to Console.Out. What objects are generated and how do I extend them? MyDataContext : DataContext MyEntity / T. LINQ to SQL: .NET Language-Integrated Query for Relational Data. MSDN Library Articles and Overviews .NET General LINQ: .NET Language Integrated Query LINQ to SQL: .NET Language-Integrated Query for Relational Data .NET Language-Integrated Query for XML Data The .NET Standard Query Operators Overview of C# 3.0 LINQ to SQL: .NET Language-Integrated Query for Relational Data 398 out of 514 rated this helpful - Rate this topic Dinesh Kulkarni, Luca Bolognese, Matt Warren, Anders Hejlsberg, Kit George March 2007 Applies to: Visual Studio Code Name "Orcas" .Net Framework 3.5 Summary: LINQ to SQL provides a runtime infrastructure for managing relational data as objects without losing the ability to query.

Contents Introduction Most programs written today manipulate data in one way or another and often this data is stored in a relational database. Of course, the differences go far deeper than that. It is no wonder that applications expected to bridge this gap are difficult to build and maintain. LINQ to SQL is designed to be non-intrusive to your application. LINQ to SQL. LINQ to SQL is a component of .NET Framework version 3.5 that provides a run-time infrastructure for managing relational data as objects. In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When the application runs, LINQ to SQL translates into SQL the language-integrated queries in the object model and sends them to the database for execution. When the database returns the results, LINQ to SQL translates them back to objects that you can work with in your own programming language. The documentation that is included with this release of LINQ to SQL describes the basic building blocks, processes, and techniques you need for building LINQ to SQL applications.

You can also search the MSDN Library for specific issues, and you can participate in the LINQ Forum, where you can discuss more complex topics in detail with experts.