In LINQ to SQL, what is the role of DataContext?
- Executes SQL queries directly on the database
- Handles data caching and optimization
- Manages database connection and transaction
- Maps database entities to CLR objects
The DataContext class in LINQ to SQL is responsible for managing the connection to the database and handling transactions. It acts as a bridge between the database and the LINQ queries, facilitating the mapping of database entities to .NET objects.
Loading...
Related Quiz
- In LINQ to DataSet, what is the primary purpose of the from clause?
- How can parameterized queries help prevent SQL injection attacks?
- Deferred execution means that a LINQ to DataSet query is not executed until you explicitly call ___________ methods.
- What are the advantages of using connection pooling in ADO.NET?
- What is the difference between a DataRow and a DataTable in ADO.NET?