What are disadvantages of LINQ over Stored Procedures?

There are the following disadvantages of LINQ over Stored Procedures. LINQ query is compiled each and every time while stored procedures re-used the cached execution plan to execute. Hence, LINQ query takes more time in execution as compared to stored procedures. LINQ is not the good for writing complex queries as compared to stored procedures. LINQ is not a good way for bulk insert and update operations. Performance is degraded if you don’t write the LINQ query correctly. If you have done some changes in your query, you have to recompile it and redeploy its dll to the server.

What is difference between LINQ and Stored Procedures?

There are the following differences between LINQ and Stored Procedures. Stored procedures are faster as compared to LINQ query since they have a predictable execution plan and can take the full advantage of SQL features. Hence, when a stored procedure is being executed next time, the database used the cached execution plan to execute that stored procedure. LINQ has full type checking at compile-time and IntelliSense support in Visual Studio as compared to stored procedure. This powerful feature helps you to avoid run-time errors. LINQ allows debugging through .NET debugger as compared to stored procedure. LINQ also supports various .NET … Click here to continue…..

What is SQL metal in LINQ?

SQL metal is a command line tool to generate code and mapping for LINQ to SQL. It automatically generates the entity classes for the given database. It is included in Windows SDK that is installed with Visual Studio. Syntax for SQL metal at command prompt

To view the options list, type sqlmetal /? at command prompt. You can define various options such as Connection Options, Extraction options, and Output options. Input file might be SQL Server .mdf file, .sdf file, or a .dbml intermediate file. It perform the following actions: Generate source code and mapping attributes or a mapping … Click here to continue…..

What is difference between IEnumerable and IList?

There are following differences between ADO.NET and Entity Framework: IEnumerable IList Move forward only over a collection, it can’t move backward and between the items. Used to access an element in a specific position/index in a list. Doesn’t support add or remove items from the list. Useful when you want to Add or remove items from the list. Find out the no of elements in the collection after iterating the collection. Find out the no of elements in the collection without iterating the collection. Supports further filtering. Doesn’t support further filtering.

When var or IEnumerable is used to store query result in LINQ?

You can use var or IEnumerable<T> to store the result of a LINQ query. You should take care of following points while choosing between var and IEnumrable. var IEnumerable Use var type when you want to make a “custom” type on the fly. Use IEnumerable when you already know the type of query result. var is also good for remote collection since var is an IQueryable type that executes query in SQL server with all filters. IEnumerable is good for in-memory collection.