what is .net core?
free and open source platform developed and maintained by microsoft
uses .net standard lib, replaces .net framework
core runs in multiple OS
can modify
integrates with UI frameworks angular vue react
can be hosted in multiple servers
built in dep inj - loosly coupled
supported by multiple IDEs
advantages of .net core over .net framework?
what is the default project structure of .net core application?
floders
wwwroot - static files like js css images
program.cs - entry point
request go here first
create builder and run
map routes???
startup.cs - config services and request pipeline for the application
set configuration, handle request pipline
appsettings.json - config settings like DB con strings other things???
what is the role of program.cs and startup.cs?
program.cs - entry point
request go here first
create builder and run
map routes???
startup.cs - config services and request pipeline for the application
set configuration, handle request pipeline
what is the role of configureservices and configure method?
configure services method - optional, called by host before configure method
can add any number of services
addcontrollerswithview() method
configure method specifies how app responds to HTTP request and response
it can add middleware components
request pipelines
user endpoints
not optional
what is dependency injection in .net core? How do we inject the service dependdency into the controller?
creates a loosely coupled design
example many controllers in application
math student created in controllers but then it changes to science student and have to change all of them
instead use IStudent then you get to define implementation in controllers
IStudent passed through constructor
Describe service lifetimes in .net core?
how long instance of class will persist
add singleton - ex: logger
create one instance when service is requested
same instance is shared by all http requests
add scoped - single instance for each request
add transient - instance is not shared
every time a new instance is created for the request
what is middle ware?
a class executed on every request in the application
set up in configure method in startup/program class
what is kestrel? what is in process and out process hosting?
in process hosting - example IIS hosting and all other uses but can only run in windows not open source
out of process hosting - kestrel used as edge (internet facing) web server
light wieght web server for asp.net app used for hosting
kestrell cross platform
what is the difference between kestrel and IIS?
what is request delegate? what are run use and map methods?
handle each http request and used to build request pipeline
run map use are extension methods
use - executes next middle ware method
run - terminates chain, no other middle ware will execute next, end of pipeline
map - executes middleware if path requested by user equalls path provided in the parameter
what is host in .net core?
host configures a server like kestrel or IIS and a request processing pipeline
what are the various techniques to save configuration settings in .net core?
appsetting.json, azure keyvault, environment variables, comand line args, in memory objects
1st 2 most common
how does routing work in .net core?
handle incomming http requests for the app, based on the url
explain attribute routing in .net core?
manipulate behaviour of url by the route attribute
describe the request processing pipline for .net core
request comes in
1. middleware
2. routing
3. controller intitialization
4. action method executes
5. result of execution
6. data result and/or view rendering
7. response with view result
can .net core work with .net 4.x framework?
yes -
what is meta package?
core framework
diagnostics hosting etc
how does .net core serve static files?
what are the various json files available in .net core?
what is .net standard?
rule or lib that is compliant with .net
what are razor pages in .net core?
development model - page centric dev model , supports all features of .net core
how is blazor different from razor?
how do you use dependency injection work in .net core?
inject dependent interface in the configure services method
use @inject directive on the view of razor page