This repository contains multiple ASP.NET Core projects and examples, demonstrating middleware, routing, controllers, static files, and more. Each folder is a self-contained sample or learning module.
- Demonstrates conditional middleware logic using the
UseWhenextension.
- A simple web application for further extension and experimentation.
- Demonstrates environment-specific configuration and usage in ASP.NET Core projects. See
Environments/MyEnvironmentsfor examples of usingappsettings.jsonandappsettings.Development.jsonto manage settings for different environments (Development, Production, etc).
- Contains examples for managing and displaying social media links in ASP.NET Core apps. See
SocialMediaLinks/MySocialMediaLinksfor sample code and configuration for handling social media URLs, icons, and environment-specific settings.
-
Contains unit test examples for ASP.NET Core projects. See
CRUD/MyUnitTestfor sample test classes and usage of xUnit for testing business logic, controllers, and services. Run tests with:dotnet test CRUD/MyUnitTest/MyUnitTest.csproj
This repository contains a large collection of ASP.NET Core and .NET sample projects, organized by topic and feature. Each folder demonstrates a specific concept, pattern, or feature in ASP.NET Core development.
- Aspire/: .NET Aspire sample solution and projects for cloud-native development.
- CitiesManager/: City management API and related configuration samples.
- Configurations/: Custom configuration and options pattern examples.
- Controllers/: Various controller samples, including banking, orders, and file handling.
- CRUD/: Full CRUD sample with entities, services, contracts, and unit tests.
- DIE/: Dependency Injection (DI) examples and documentation.
- DIWeatherApp/: Weather app demonstrating DI and service contracts.
- Environments/: Environment-specific configuration and usage.
- MiddleWare/: Custom middleware implementations and usage.
- Routing/: Routing and route constraint samples.
- SocialMediaLinks/: Managing and displaying social media links in ASP.NET Core.
- StaticFiles/: Serving static files (PDFs, images, etc.) from ASP.NET Core apps.
- StockApp/: Stock app sample and configuration.
- UseWhen/: Conditional middleware logic using the
UseWhenextension. - ViewComponents/: View component samples for ASP.NET Core MVC.
- Views/: Razor views and view samples.
- WebApp/: Basic ASP.NET Core web application.
- .NET 9 SDK
- macOS, Windows, or Linux
- Clone the repository:
git clone https://github.com/EdmondAndy/aspnet.git
cd aspnet- Build a project (example for MyMiddleware):
dotnet build MiddleWare/MyMiddleware/MyMiddleware.csprojYou can build other projects similarly by specifying their .csproj file.
- Run a project (example for MyWebApp):
dotnet run --project WebApp/MyWebApp/MyWebApp.csprojReplace the project path as needed for other samples.
appsettings.jsonandappsettings.Development.json: Configuration files for each project.Program.cs: Main entry point for each application.Properties/launchSettings.json: Debug and launch settings.Controllers/: Contains controller classes for handling HTTP requests.wwwroot/: Static files (PDFs, images, etc.) served by the app.Environments/: Contains projects and examples for environment-based configuration and settings.
Unit tests are provided in CRUD/MyUnitTest and other folders. Run tests with:
dotnet test CRUD/MyUnitTest/MyUnitTest.csprojPull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.
- Clone the repository:
git clone https://github.com/EdmondAndy/aspnet.git
cd aspnet- Build a project:
dotnet build MiddleWare/MyMiddleware/MyMiddleware.csproj
dotnet build UseWhen/MyUseWhen/MyUseWhen.csproj
dotnet build WebApp/MyWebApp/MyWebApp.csproj- Run a project:
dotnet run --project MiddleWare/MyMiddleware/MyMiddleware.csproj
dotnet run --project UseWhen/MyUseWhen/MyUseWhen.csproj
dotnet run --project WebApp/MyWebApp/MyWebApp.csprojappsettings.jsonandappsettings.Development.json: Configuration files for each project.Program.cs: Main entry point for each application.Properties/launchSettings.json: Debug and launch settings.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.