Executing SQL Query using LINQ to SQL

In this post, I will discuss how we can execute a SQL Query directly from LINQ. Explanation To execute SQL query there is a method in DataContext class called ExecuteQuery ExecuteQuery takes two input parameter 1. SQL Query as string 2. Parameters used in SQL query And it returns an IEnumerable. Example Below code will […]

Resolving Concurrency conflicts in LINQ

While performing database operation, one major thing need to be taken care of is Concurrency Conflicts. Concurrency conflict can happen when two sources are try to modify database at the same time. Let us understand conflict in LINQ with an example, From above diagram you can infer that, essentially there are three steps involved in […]

Logging in LINQ to SQL

It is very common that may come in your mind that, how we can see SQL query being generated at the back end for LINQ query. Assume you have a LINQ as below, If you want to view SQL query generated for above LINQ on console screen you need to add just one line of […]