본문 바로가기
C#(CSharp)/Etc

Which is best LINQ or SQL queries?

by swconsulting 2018. 2. 4.

I'm assuming that you are referring to LINQ-to-SQL when you mean LINQ, which is basically using LINQ syntax to create and query your databases much like you would using SQL.

I would recommend checking out this Stack Overflow discussion, which covers some of the advantages of using LINQ-to-SQL such as : 

  • No magic strings, like you have in SQL queries
  • Intellisense
  • Compile check when database changes
  • Faster development
  • Unit of work pattern (context)
  • Auto-generated domain objects that are usable small projects
  • Lazy loading.

and you can also find specific advantages when working with stored procedures as well. 

It is important to note that pure SQL is almost always going to have improved performance over using LINQ, which is simply going to generate SQL queries itself. So in essence, you are still doing the same thing, but I've found that using LINQ to handle it can make things move much quicker and easier especially when dealing with overly complex queries.

So - there really isn't any "best" approach to the situation and the two can be used interchangably. 


Source : https://forums.asp.net/t/1902512.aspx?Which+is+best+LINQ+or+SQL+queries+

'C#(CSharp) > Etc' 카테고리의 다른 글

Internet Feature Controls  (0) 2018.02.05
Convert webpage to image  (0) 2018.02.04
Populate data table from data reader  (0) 2018.02.02
TraceListener  (0) 2017.12.07
Simple and Powerful Debug function  (0) 2017.10.18