0% found this document useful (0 votes)
26 views3 pages

Dotnetcore Questions

DOTNETCORE_QUESTIONS.docx

Uploaded by

manish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

Dotnetcore Questions

DOTNETCORE_QUESTIONS.docx

Uploaded by

manish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Q: Dependency Injection

Dependency injection is the design pattern that allows us to inject the dependency into the class from the outer world
rather than creating with in class. This will help us to create loosely coupled applications so that it has provided greater
maintainability, testability, and also reusability.

Singleton is a single instance for the lifetime of the application domain.


Scoped is a single instance for the duration of the scoped request, which means per HTTP request in ASP.NET.
Transient is a single instance per code request.

Q: What is .NET Core?


.NET Core is a free, open-source, cross-platform framework for building modern applications. It was designed to be fast,
lightweight, and modular, and it supports a variety of programming languages, including C#, F#, and Visual Basic.

Q: What are the benefits of using .NET Core?


There are several benefits of using .NET Core, including:
● Cross-platform support: .NET Core runs on Windows, Linux, and macOS, making it easy to develop and deploy
applications on different platforms.
● High performance: .NET Core is designed to be fast and efficient, with built-in support for asynchronous
programming and other performance optimizations.
● Modular architecture: .NET Core is built around a modular architecture, which means that you can use only the
components you need, and you can add or remove components as needed.
● Open source: .NET Core is open source, which means that you can access the source code, contribute to the
project, and customize the framework to meet your needs.

Q: What is the difference between .NET Framework and .NET Core?


.NET Framework is a Windows-only framework that has been around since 2002, while .NET Core is a cross-platform
framework that was introduced in 2016. .NET Framework includes a large set of libraries and APIs for building Windows
applications, while .NET Core is a modular framework that includes only the components you need for your application.
.NET Core also has better performance and scalability than .NET Framework, and it can be used to build applications for
a wider range of platforms.
Q: What are the different types of project templates available in .NET Core? A: .NET Core includes several project
templates, including:
● Console Application: A basic console application that can be used for testing or command-line tools.
● Class Library: A library of reusable code that can be shared across multiple projects.
● ASP.NET Core Web Application: A template for building web applications using the ASP.NET Core framework.
● Razor Class Library: A library of Razor components that can be shared across multiple ASP.NET Core projects.
● Unit Test Project: A project for writing and running unit tests.

Q: What is dependency injection in .NET Core?


Dependency injection is a design pattern used in .NET Core to manage the dependencies between objects. In this
pattern, objects are not responsible for creating their own dependencies; instead, they receive them from an external
source, such as a container. This makes it easier to manage and test the code, and it allows for more modular and
scalable applications.

Q: What is middleware in ASP.NET Core?


Middleware is a pipeline of components that can be used to handle HTTP requests and responses in ASP.NET Core. Each
component in the middleware pipeline performs a specific function, such as authentication, routing, or logging. The
middleware pipeline is configured using the Startup class, and it can be customized to meet the needs of the application.

Q: What is the difference between synchronous and asynchronous


programming in .NET Core?
Synchronous programming involves executing tasks one after another, while asynchronous programming allows tasks to
run concurrently. In .NET Core, asynchronous programming is achieved using the async and await keywords, which allow
tasks to be run in the background while the program continues to execute other code. Asynchronous programming can
improve the performance and scalability of applications, especially for I/O-bound tasks such as network or database
operations. However, it can also be more complex to implement than synchronous programming.

Q: Filters in MVC ?
In ASP.NET MVC, a user request is routed to the appropriate controller and action method. If you want to execute some
logic before or after an action method executes. ASP.NET MVC provides filters for this purpose.

There are five types of filters we can use in MVC.


1. Authentication Filter
2. Authorisation Filter
3. Action Filter
4. Result Filter
5. Exception Filter

We can set filters at application level, controller level & action method end.

Filter Type Description Built-in Filter Interface

Authorization Performs authentication and authorizes before [Authorize], IAuthorizationFilter


filters executing an action method. [RequireHttps]

Action filters Performs some operation before and after an action IActionFilter
method executes.

Result filters Performs some operation before or after the [OutputCache] IResultFilter
execution of the view.

Exception filters Performs some operation if there is an unhandled [HandleError] IExceptionFilter


exception thrown during the execution of the
ASP.NET MVC pipeline.

You might also like