Nizamuddin Siddiqui has Published 2307 Articles

How do I copy items from list to list without foreach in C#?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 11:01:32

915 Views

The List is a collection of strongly typed objects that can be accessed by index and having methods for sorting, searching, and modifying list. It is the generic version of the ArrayList that comes under System.Collection.Generic namespace.List equivalent of the ArrayList, which implements IList.It comes under System.Collection.Generic namespace.Listcan contain elements ... Read More

What is the AddSingleton vs AddScoped vs Add Transient C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:55:59

9K+ Views

There are three ways by which dependencies can be registered in Startup.cs. i.e. AddSingleton, AddScoped and AddTransient.Add SingletonWhen we register a type as singleton, only one instance is available throughout the application and for every request.It is similar to having a static object.The instance is created for the first request ... Read More

How to handle errors in middleware C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:54:36

2K+ Views

Create a new folder named CustomExceptionMiddleware and a class ExceptionMiddleware.cs inside it.The first thing we need to do is to register our IloggerManager service and RequestDelegate through the dependency injection.The _next parameter of RequestDeleagate type is a function delegate that can process our HTTP requests.After the registration process, we need ... Read More

What is Metapackage in C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:52:07

3K+ Views

It is known that Microsoft.AspNetCore package is one of the packages added to many ASP.NET Core templates.The Microsoft.AspNetCore package is repeatedly included as one of the usual project dependencies when opening a new ASP.NET Core project. It delivers many of the crucial packages to position up a basic ASP.NET Core ... Read More

What is the purpose of Program.cs file in C# ASP.NET Core project?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:50:45

1K+ Views

ASP.NET Core web application is actually a console project which starts executing from the entry point public static void Main() in Program class where we can create a host for the web application.public class Program{    public static void Main(string[] args){       BuildWebHost(args).Run();    }    public static ... Read More

What is the use of UseIISIntegration in C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:49:24

2K+ Views

All ASP.NET Core applications require a WebHost object that essentially serves as the application and web server. WebHostBuilder is used to configure and create the WebHost. You will normally see UseKestrel() and UseIISIntegration() in the WebHostBuilder setup code.What do these do?UseKestrel() − This registers the IServer interface for Kestrel as ... Read More

What is the role of IWebHostEnvironment interface in C# ASP.NET Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:46:15

4K+ Views

IWebHostEnvironment Provides information about the web hosting environment an application is running in.belongs to namespace Microsoft.AspNetCore.HostingThe IWebHostEnvironment interface need to be injected as dependency in the Controller and then later used throughout the Controller.The IWebHostEnvironment interface have two properties.WebRootPath − Path of the www folder(Gets or sets the absolute path ... Read More

What is Kestral C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:44:47

3K+ Views

Kestrel is a cross-platform web server for ASP.NET Core. It is supported on all platforms and versions that .NET Core supports.It is included by default as internal server in ASP.NET Core. Kestrel can be used, by itself as an edge server i.e Internet-facing web server that can directly process the ... Read More

How C# ASP.NET Core Middleware is different from HttpModule?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:43:56

903 Views

HttpModules are configured via web.config or global.asax Developer don’t have control on order of execution.As order of modules is mainly based on application life cycle events. The execution order remains same for requests and responses.HttpModules helps you to attach code specific to a application events. HttpModules are tied to System.web.Middleware ... Read More

How to specify service lifetime for register service that added as a dependency C# Asp.net Core?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 25-Sep-2020 10:41:49

509 Views

Built-in IoC container manages the lifetime of a registered service type. It automatically disposes a service instance based on the specified lifetime.The built-in IoC container supports three kinds of lifetimes −Singleton − IoC container will create and share a single instance of a service throughout the application's lifetime.Transient − The ... Read More

Advertisements