source02 0 - LINQ With Data Source ( MSSQL To LINQ ) - Free Source Code

LINQ With Data Source ( MSSQL To LINQ ) – Free Source Code

Posted on

source02 0 - LINQ With Data Source ( MSSQL To LINQ ) - Free Source Code

My earlier tutorial I’ve described fundamental of LINQ and methods to coping with XML recordsdata. On this tutorial I’m going to elucidate you methods to take care of rational knowledge sources. On this tutorial you’ll be perceive how does LINQ assist us coping with non-object oriented knowledge buildings like coping with rational knowledge.
Right here we’re going to join SQL Server database and going to create SQL to LINQ knowledge supply. To do this at first we have now to create DBML file which comprises c# code which helps write LINQ queries.

We’re making a databse known as TEST and it has following two tables

Then we have to add out database into our take a look at project
Go to
Instruments – > hook up with database

Add required database connection parameters. After efficiently added database in to our project, we have to DBML file. There are few object relations mapping accessible however they’ve their very own execs and cons. LINQ is among the finest object relation mapping applied sciences accessible in pc world.

Now we’re going to create DBML file.

Create a brand new folder known as TESTSQL in our project.

Choose LINQ To SQL Class on new merchandise menu give Title as Take a look at and click on add

Then double click on on DBML file

Then Proper click on on server explorer and Drag the tables in to DBML Left pane. Then you possibly can see the desk with their relation.

After that drag the shops procedures to proper pane, now you possibly can see the strategies.

If you find yourself create Take a look at.dbml file it’s going to add associated context class that can be utilized to entry tables and soared procedures