Thread Safe Concurrent Collection in C#

Concurrent Collection The .NET Framework 4 brought the System.Collections.Concurrent namespace. This has several collection classes that are thread-safe and scalable. These collections are called concurrent collections because they can be accessed by multiple threads at a time. The following are the concurrent collection in C# − Sr.No Type & Description 1 BlockingCollection<T> Bounding and blocking functionality for any […]

Entity Framework, ToList vs AsEnumerable vs AsQueryable

ToList() Execute the query immediately AsEnumerable() lazy (execute the query later) Parameter: Func&lt;TSource, bool&gt; Load EVERY record into application memory, and then handle/filter them. (e.g. Where/Take/Skip, it will select * from table1, into the memory, then select the first X elements) (In this case, what it did: Linq-to-SQL + Linq-to-Object) AsQueryable() lazy (execute the query later) Parameter: Expression&lt;Func&lt;TSource, bool&gt;&gt; Convert Expression into […]

The Unstated React Service Pattern

This guide demonstrates a React Pattern for sharing global state, without requiring any of the following: 😒 Prop-Drilling 🔥 Redux 💲 MobX 🏀 Apollo Link State (The above emojis were auto-selected by Emoj) The Context API Recently I found myself at an Advanced React Training with Michael Jackson(no… not the King of Pop, the King of React Router 😉). We spent a good deal of the […]

You Might Not Need Redux

People often choose Redux before they need it. “What if our app doesn’t scale without it?” Later, developers frown at the indirection Redux introduced to their code. “Why do I have to touch three files to get a simple feature working?” Why indeed! People blame Redux, React, functional programming, immutability, and many other things for their woes, and I […]

ASP.NET MVC 5: Using a Simple Repository Pattern for Performing Database Operations

Abstract: The Repository pattern decouples your ASP.NET MVC application and shields it from changes by creating a boundary between your data access code and the other parts of your application. Recently a client of mine asked for a solution to isolate the direct dependency of the Data Access Layer with the rest of the layers of the application. In […]

How to Implement the Repository Pattern in ASP.NET MVC Application

The Repository Pattern is one of the most popular patterns to create an enterprise level application. It restricts us to work directly with the data in the application and creates new layers for database operations, business logic, and the application’s UI. If an application does not follow the Repository Pattern, it may have the following problems: Duplicate database […]