Posts

Showing posts from February, 2023

Sticky Session- Load Balancing

Image
Session stickiness , also known as(aka)., session persistence, is a process in which a load balancer creates an affinity between a client and a specific network server for the duration of a session, (i.e., the time a specific IP spends on a website). Using sticky sessions can help improve user experience and optimize network resource usage. With sticky sessions, a load balancer assigns an identifying attribute to a user, typically by issuing a cookie or by tracking their IP details. Then, according to the tracking ID, a load balancer can start routing all of the requests of this user to a specific server for the duration of the session This can prove very helpful, as HTTP/S is a stateless protocol that was not devised with session persistence in mind. Nevertheless, many web applications do have the need to serve personalized user data over the course of a session. Without session persistence, the web application would have to maintain this information across multiple servers, which can

Dapper Framework in C#

  Dapper is a simple object mapper for .NET and owns the title of King of Micro ORM in terms of speed and is virtually as fast as using a raw ADO.NET data reader.  An ORM is an Object Relational Mapper responsible for mapping between a database and a programming language. Dapper is a popular open source Object-Relational Mapping (ORM) Library for .NET. It makes it easy to work with data in your application by mapping objects to tables in a database. Dapper is fast, reliable, and well-tested and has been used in production by some of the world's largest companies for many years. It is very easy to use and has a lot of features that make it a powerful tool for data access. Dapper is faster than Entity Framework for CRUD operation (querying and saving) due to its simplicity. Unlike EF Core, it doesn't have to add all complexity, such as tracking values, writing inefficient SQL queries, and supporting features like lazy loading and all inheritance by default. However, EF Core is r

ORM programming technique in C#

Image
  In most of the applications, to achieve loose coupling, we maintain an ORM layer between a software application and the database, which maps database tables to C# entities. ORM Layer ORM layer is responsible to map database tables to c# entities and visa versa. We have many ORM libraries available in C#, out of which the below are some main libraries Entity framework Dapper NHibernate Dapper Dapper is an ORM library, which extends methods of IDbConnection interface. These extension methods have efficient code to perform insert, update delete and select methods. These extension methods are, Execute Query QueryFirstOrDefault QuerySingle QuerySingleOrDefault QueryMultiple Let’s start with the implementation of CRUD operation using dapper. Step 1 Create a database and a table. Create table Student (Id Int Identity, Name Varchar(100), Marks Numeric)   Step 2 Open Visual Studio. File - New Project - WPF App (You can create either console application or web application according to your pre