Wriju's BLOG

.NET, Cloud and everything

LINQ to SQL : Object Relational (O/R) Model

LINQ to SQL is pure Object Relational Model introduced by Microsoft. It used mapping mechanism to represent

 

Relational Components

Object Component

Table

Class

Column

Property

Foreign-key relationship

Association

 

It gets the user input through this object model and gives the translated value to SQL in form of pure T-SQL query and when query gives something back it again translates back to the strongly typed object model. There is a very close relationship between Object and Relation here.

 

You can perform all sort of data manipulation process offline (like INSERT) and store them in collection. Once you are okay with the set you use DataContext class to submit the changes back to the database. Then LINQ to SQL translates the object to set of parameterized T-SQL query and gives the input to database.

 

LINQ to SQL Object Model

 

In lot of scenarios LINQ to SQL is faster than pure ADO.NET approach and with Orcas Beta 2 it started giving much better performance. LINQ to SQL is highly capable to running DML operations.

 

For modifications over the existing data it uses optimistic concurrency which helps us to prevent the data manipulation conflicts which is again an added advantage.

 

For more please visit MSDN Site.

 

Namoskar!!!