As.Net core

Updated : Mar 14, 2020 in Articles

Introduction about Core 2.2

in this article, we will learn about Core 2.2 basic fundamentals

What is core? Core is a cross-platform, high-performance and opensource framework for building modern cloud-based or internet-based Applications


  • Cross-flatform
  • On programming model for MVC and Web API
  • Modularity
  • dependency injection
  • Opensource
  1. Cross-flatform:- core applications can be developed and run cross platforms like
  • Windows,
  • Linux,
  • macOS core applications can be hosted in

  • IIS,
  • apache,
  • docker
  • itself hosted in your own way other servers also

2. On programming model for MVC and Web API: In MVC framework controllers are not supported to web API for that we will separately implement restful Apis but in core MVC controllers and Web API controllers both are inherited from the same controller base class returns IActionresult

IActionresult it will return ViewResult and JSON result also

3. Modularity: core will provide modularity with middleware components both request and response pipeline is working under the middleware component only and custom middleware component can also be created core it will provide to us a rich set of built-in middleware components see the following given sample image core request and response will work order wise through the middleware components

All things that happen before the next() method is invoked in each of the middleware components and the request travels from middleware to middleware through the pipeline see the above figure (request, response)

Static middleware: In core by default directory for store static files (CSS files, js files, images )in wwwroot and default core applications will not serve(accessing ) static file for that we will use UsestaticFiles()middleware is required and for accessing default file(HTML files) we need UseDefaultFile() middleware is required

see the given below example to configure the middlewares at startup.cs file

UseDefaultFile() middleware must be register before the UsestaticFiles()

instead of using UsestaticFiles(), UseDefaultFile() middlewares we will use UseFileServer() middleware it will process the both above middleware requests

UseFileServer () middleware it is a combination of functionality of UsestaticFiles() ,UseDefaultFile() middlewares

4. dependency injection: compare to MVC framework core in itself can contain dependency injection and in core dependency injection are loosely coupled we will configure all the services in a startup.cs file we will use these services along with the application core Dependency injection to register with dependency injection container like

  • AddSingleton()
  • Addtransient()
  • AddScope()

AddSingleton(): if you are using AddSingleton() service we have created only a single instance that single instance is used by all HTTP request through an application

AddScope(): if you are using scoped services we get the same instance within the scope of a given request but for every new HTTP request new instance will create

Addtransient (): if you are using trance services a new instance is created every time an instance is requested whether it is in the scope of the same HTTP request or across different HTTP requests

5. Opensource: core is opensource see the following link pull the source code from Git hub.

Latest posts by DuttaluruVijayakumar (see all)
Like Love Haha Wow Sad Angry

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x