Skip to main content

Posts

Showing posts with the label LINQ Architecture in ASP Net C#

LINQ filtering Operators - where clause

The where clause is a filtering operator and used to filter a collections based on the some specific criteria and after that returns the values from collection based on your given criteria (returns those which are specified condition is true). It is accepts a predicate as a parameter. The where extension method has following two overloads, 1.       Func <TSource, bool> 2.       Func<TSource,  int, bool> A single LINQ query may contain multiple where clauses and a single clause may contain multiple predicate sub expressions. The multiple where extension methods are valid in a single LINQ query. For example, Multiple where clauses query, var query = base .Context.Carts.Where(x => x.EmailID == EmailID)         .Where(x => x.IsDeleted == false ) //APPLIED TO THE RESULT OF THE PREVIOUS.         .OrderByDescending...

"How to Use" IEnumerable and IList [IEnumerable vs. IList]

When you should use IEnumerable and when IList? You should use IList when you need access by index to your collections and also when you need Add , delete , modify , ordering and / or positioning of your elements in the collections etc. You should use IEnumerable when you need to enumerate over your collection and represents a forward only cursor and also for querying data from in memory collections like Array , List , and collations etc. Stayed Informed - IEnumerable vs. IQueryable Actually, IList interface implements both the interfaces ICollection and IEnumerable and this interface allows us to add, remove, modify and ordering or positioning to items in the collections. The IList interface has more power than the preceding two interfaces ICollection and IEnumerable. The IList Interface contains as, 1.       Indexer 2.       Indexof Method 3.       Add Method 4...

"How to Use" IEnumerable and IQueryable [IEnumerable vs. IQueryable]

Both the IEnumerable and IQueryable interfaces are for . NET collections, so if you are new please see this article  and t he IQueryable interface inherits from IEnumerable interface, so whatever IEnumerable can do, IQueryable can also do. The IQueryable   interface   is the same as IEnumerable   interface    but it also provides additional functionality to implement custom querying with LINQ. Stayed Informed - IEnumerable vs. IList There are some differences over the interfaces IEnumerable and IQueryable as given below. IEnumerable :- The IEnumerable <T> interface exists in the namespace “ System.Collections ”. The IEnumerable <T> represents a forward only cursor of T . The IEnumerable <T> interface is fit for querying data from in memory collections like Array , List , and collations etc. While us querying data from the database. The IEnumerable executes SELECT Query on the server side, load list o...

LINQ Architecture in ASP .Net C#

The LINQ has a 3 layered Architecture. In the upper layer consists of the language extensions and the bottom layer consists of data sources that are typically objects implementing IEnumerable <T> or IQueryable <T> generic interfaces. The LINQ contain some major components, 1.       LINQ to Objects. 2.       LINQ to ADO.NET, which includes. 3.       LINQ to SQL (formerly called DLinq). 4.       LINQ to DataSet (formerly called LINQ over DataSet). 5.       LINQ to Entities. 6.       LINQ to XML (formerly called XLinq). The LINQ Architecture show as below,