AGENDA• INTRODUCTION TO LINQ• LINQ AND .NET FRAMEWORK• What is Data Context Object?• Working of LINQ.• LINQ TO SQL (WITH EXAMPLES)
INTRODUCTION TO LINQ• LINQ stands for Language Integrated Querying.• Language Integrated Querying (LINQ) is Microsoft’s first attempt to integrate Queries into a Language.• Model which overcomes the traditional approach to access data.• Visual Studio provides IntelliSense Features and also integrated debugger to debug queries.• LINQ can interact with any kind of data source and hence reduces the headaches of learning new techniques.
LINQ and Dot Net Framework C# 3.0 VB 9.0 OTHERS DOT NET LANGUAGE INTEGRATED QUERY - LINQ LINQ TO LINQ TO LINQ TO LINQ TO LINQ TO SQLCOLLECTIONS DATASET XML ENTITIES OBJ 1 XMLOBJ OBJ FILE 2 3 OBJECTS DATABASES XML
What is DataContext Object?• DataContext is a Class, which helps creating a connection with the database.• It represents the Tables and the Stored Procedures we created in the database.• Helps to create and delete a Database. Provides CreateDatabase() and DeleteDatabase() functions.• It submits the information sent using Objects and make changes in the database.
Working of LINQ• Sending data from Application to the database is a 2 step process in Linq.• Database Operation is done by Data Context Object. Data is transferred from the Entity to the DataContext Object.• LINQ provides “InsertOnSubmit()”, “DeleteOnSubmit()” to do the in-memory operations.• For applying the changes in the physical database, the “SubmitChanges()” has to be called.