How can you handle concurrency at field level in LINQ to SQL?

In LINQ to SQL, you can also handle concurrency at field level and this is the best way provided by the LINQ. To achieve this you need to define UpdateCheck attribute at field level and it has the following options: Never: – This option will never check for concurrency conflicts…. Continue reading

How can you handle concurrency in LINQ to SQL?

When multiple users are updating the same record at the same time, a conflict will occur. To handle this concurrency conflicts, LINQ provides you following three ways. KeepCurrentValues – This option will remains the LINQ object values as it is and does not push the new values from the database… Continue reading

What is difference between ADO.NET and LINQ to SQL?

There are following differences between ADO.NET and Entity Framework: ADO.NET LINQ to SQL It is a part of .NET Framework since .NET Framework 1.0 It is a part of .NET Framework since .NET Framework 3.5 SqlConnection/OleDbConnection is used for database connectivity. We can use context for database connectivity. Difficult to… Continue reading

What is difference between XElement.Load() and XDocument.Load()?

XElement and XDocument are very similar in function, but not interchangeable when you are loading a document from a data source. Use XElement.Load () when you want to load everything under the top-level element, Use XDocument.Load () when you want to load any markup before the top-level element.

What is difference between XElement and XDocument?

XElement and XDocument are the classes defined with in System.Xml.Linq namespace. XElement class represents an XML fragment. While XDocument class represents an entire XML document with all associated properties. For Example: XDocument doc = new XDocument(new XElement(“Book”, new XElement(“Name”, “.NET Interview FAQ”), new XElement(“Author”, “Shailendra Chauhan”)) );  

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… Continue reading

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… Continue reading

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 sqlmetal [options] [<input file>] To… Continue reading

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… Continue reading

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… Continue reading