Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does a linq to sql provider work?


Asked by Haylee Davis on Dec 07, 2021 SQL



LINQ to SQL Provider − converts query to Transact SQL (T-SQL) and sends the new query to the ADO Provider for execution. ADO Provider − After execution of the query, send the results in the form of a DataReader to LINQ to SQL Provider which in turn converts it into a form of user object.
Moreover,
LINQ to SQL API − requests query execution on behalf of an application and sent it to LINQ to SQL Provider. LINQ to SQL Provider − converts query to Transact SQL (T-SQL) and sends the new query to the ADO Provider for execution.
And, ADO Provider − After execution of the query, send the results in the form of a DataReader to LINQ to SQL Provider which in turn converts it into a form of user object. It should be noted that before executing a LINQ to SQL query, it is vital to connect to the data source via DataContext class.
Accordingly,
The LINQ providers are in no way stand alone tools. They can be used directly in any of the .NET programming languages. LINQ allows us to access information by writing queries against various data sources. We all are quite familiar with writing SQL queries.
In addition,
The Execute method is used to actually execute a query expression, i.e. in a custom provider we will get the data from the datasource, for example a webservice or database etc. and it’s in the Execute method that we both get the data and do any conversion to, say SQL or the likes (if the LINQ query ultimately queries some other system.