0% found this document useful (0 votes)
6 views5 pages

Notes

ASP.NET is a free, open-source framework for building web applications and services using C# and .NET, offering features like full-stack development, API creation, and real-time capabilities. It supports modern development practices, microservices, and is suitable for enterprise-level applications with high security and scalability. The document also outlines command line operations, configuration management, dependency injection, and middleware functionalities within the ASP.NET ecosystem.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Notes

ASP.NET is a free, open-source framework for building web applications and services using C# and .NET, offering features like full-stack development, API creation, and real-time capabilities. It supports modern development practices, microservices, and is suitable for enterprise-level applications with high security and scalability. The document also outlines command line operations, configuration management, dependency injection, and middleware functionalities within the ASP.NET ecosystem.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

[Link] : framework to build web apps and services using C# and .

Net, fast one stack to build an app

- Free
- Cross platform
- Open source
- Provide Fullstack web app (MVC)
- Create apis
- Real-time (web socket, signalR)
- Provide Microservices
- Modern (high performance)
- Scalability
- Suitable for Enterprise (high security, reliability)
- High demand
- Trust (used big huge companies)
- Opportunities Varity (cloud,Aspire,etc.. )
- Blazor (provide UI)
- Modern tools (supports cutting-edge development)

.net SDK => framework for development and contains the runtime also (toolbox)
.net runtime => Provides the environment for running .NET apps.
------------------------

CMD: Terminal

- General Commands:
o Dir : show all folder content
o CD(change directory): go to directory
o Mkdir (make dir): create director
o Rmdir (remove dir): remove director
- .Net Commands:
o Dotnet --help
o Dotnet new => used to create new project
 Dotnet new - - helper
 Dotnet new Console -- name --framework –language
 Dotnet new sln --name
o Dotnet build
 Accepts any dir contains csproj or sln
 -- output: to choose where to place the build output
o Dotnet run :
 Must be used where the csporj is exists
o Dotnet [Link]=> to run the dll
o Dotnet add : used to add anything to anything
 Dotnet add [[Link]] reference [[Link]] [[Link]]
o Dotnet add package
 Example : dotnet add package Humanizer --version 2.14.1
o Dotnet remove package [package name
o dotnet sln .\[Link] add .\ABC\[Link]
o ]

Configurations:
Providers:

1- System environment variables (OS)


2- Project Specific environment variables =>just local env
3- Command line provider => Highest priority
4- UserSecretsProvide => local
a. Sensitive data
b. Way: dotnet user-secrets init , dotnet user-secrets set “var” “123”
5- File provide (json, xml,..)
6- In-memory => used while testing , override all settings

Read Configurations :
Two ways to read configuration:
1- using IConfiguiration
1- Get value by Key : IConfiguration[key]
2- Get value by path : IConfiguration[ConnectionStrings:Default]
3- Get connection string: [Link](“Default”)
4- Get single value : [Link]<string>(“AppName”)
5- Get by section value : [Link](“ConnectionStrings”).
GetValue<string>(“AppName”)
6- Get by Section object : [Link](nameof(ClassName)).Get< ClassName >()
7- Get by Section object binding :
a. First create the setting object: AppSettings appSettings=new AppSettings();
b. Pass it : [Link](nameof(ClassName)).bind(appSettings)

2- using IOptionConfiguiration =>

To use IOption we need to register it


[Link]<AppSettings>([Link]
n([Link]));
-
or

[Link]<AppSettings>().Bind([Link]
Section([Link]));

ways:
using :
1- IOption: single snapshot taken at project starting up
2- IOptionSnapshot: request level
3- IOptionMonitor : Realtime , usually used in Background jobs
Dependency Injection
- Dependency:
o Any class or service that another class depending on.
- Inversion Of Control (IOC): it’s a concept
o Depending on the framework to create the objects rather than the code.
- Dependency Inversion Principle (DIP): it’s a SOLID principle
o High level module must depend on abstraction rather than concrete class
- Dependency Injection: it’s a Pattern
o Passing the dependencies to the class rather than creating them inside.

Middlewares
- Branching:
1- [Link]() => Branches based on a path prefix (isolated pipeline)
Map(string pathMatch, Action<IApplicationBuilder>
configuration)
2- [Link]() => same like [Link] added more flexibility (isolated pipeline)
MapWhen(Func<HttpContext, bool> predicate,
Action<IApplicationBuilder> configuration)
3- [Link]() => used to apply custom middleware based on condition backing
to the main pipeline
MapWhen(Func<HttpContext, bool> predicate,
Action<IApplicationBuilder> configuration)

You might also like