|
|
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
| Asp Net Core ist ein Open-Source-Framework von Microsoft, das zum Erstellen von Webanwendungen und Webdiensten verwendet wird. Es wurde entwickelt, um die Leistung und Skalierbarkeit von Webanwendungen zu verbessern, indem es eine modulare Architektur und eine Vielzahl von Funktionen und Tools bietet.
| | == Lernplan für ASP.NET Core == |
| | === Einführung === |
| | * Was ist ASP.NET Core? |
| | * Unterschiede zwischen ASP.NET und ASP.NET Core |
| | * Installation und Einrichtung der Entwicklungsumgebung |
|
| |
|
| == Ubuntu 24.04 Installation == | | === Grundlagen === |
| Um Asp Net Core auf Ubuntu 24.04 zu installieren, müssen Sie zunächst das .NET SDK installieren. Dies kann über das Terminal mit dem folgenden Befehl erfolgen:
| | * Erstellen eines einfachen ASP.NET Core Projekts |
| <pre>
| | * Verzeichnisstruktur und wichtige Dateien |
| sudo apt-get update && \
| | * Middleware und der Request-Processing-Pipeline |
| sudo apt-get install -y dotnet-sdk-8.0
| |
| dotnet tool install --global dotnet-ef
| |
| dotnet tool install --global dotnet-aspnet-codegenerator
| |
| echo 'export PATH=$HOME/.dotnet/tools:$PATH' >> ~/.bashrc
| |
| source ~/.bashrc
| |
| </pre>
| |
|
| |
|
| == Visual Studio Code Erweiterungen == | | === MVC-Architektur === |
| <pre>
| | * [[Program.cs (Asp Net Core)]] |
| code --install-extension ms-dotnettools.csdevkit
| | * Model-View-Controller (MVC) Muster |
| code --install-extension kreativ-software.csharpextensions
| | * Erstellen von Controllern |
| </pre>
| | * Erstellen von Views |
| | * Arbeiten mit Models |
|
| |
|
| == Asp Net Core Grundlagen lernen == | | === Routing === |
| ==mvc== | | * Grundlagen des Routings |
| <pre>
| | * Attribut-Routing |
| dotnet new mvc -n Website -au Individual
| | * Konventionelles Routing |
| cd Website
| |
| dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL
| |
| dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL.Design
| |
| dotnet add package Microsoft.EntityFrameworkCore.Design
| |
| dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
| |
| dotnet add package Microsoft.EntityFrameworkCore.Tools
| |
| dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite
| |
| dotnet ef dbcontext scaffold Name=PostgresConnection Npgsql.EntityFrameworkCore.PostgreSQL -o Models
| |
| dotnet ef migrations add InitialCreate -c ApplicationDbContext --output-dir Data/Migrations -p Website.csproj -s Website.csproj
| |
| dotnet ef database update -c ApplicationDbContext -p Website.csproj -s Website.csproj
| |
| </pre>
| |
|
| |
|
| ==Weiter einstellung in Program.cs== | | === Dependency Injection === |
| <pre>
| | * Was ist Dependency Injection? |
| var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
| | * Konfigurieren von Dependency Injection in ASP.NET Core |
| builder.Services.AddDbContext<ApplicationDbContext>(options =>
| | * Verwenden von Dependency Injection in Controllern |
| options.UseNpgsql(connectionString));
| |
| builder.Services.AddDatabaseDeveloperPageExceptionFilter();
| |
| </pre>
| |
| ==Weiter einstellung in appsettings.json==
| |
| <pre>
| |
| {
| |
| "ConnectionStrings": {
| |
| "DefaultConnection": "Host=localhost;Database=thorsten;Username=thorsten;Password=Test"
| |
|
| |
|
| },
| | === Sicherheit === |
| </pre>
| | * Authentifizierung und Autorisierung |
| * [[ASP NET CORE Controller]] | | * Identity Framework |
| * [[ASP NET CORE Model]] | | * Schutz vor CSRF (Cross-Site Request Forgery) |
|
| |
|
| ==Weblinks== | | === Web APIs === |
| * [https://learn.microsoft.com/de-de/aspnet/core/?view=aspnetcore-6.0 Offizielle Asp Net Core Dokumentation] | | * Erstellen einer Web API |
| | * Routing und HTTP-Methoden |
| | * Serialisierung und Deserialisierung von JSON |
| | * Versionierung von APIs |
| | |
| | === Fortgeschrittene Themen === |
| | * Middleware erstellen |
| | * Logging und Fehlerbehandlung |
| | * Konfiguration und Umgebungsvariablen |
| | * Testen von ASP.NET Core Anwendungen |
| | |
| | === Deployment === |
| | * Deployment auf IIS |
| | * Deployment auf Azure |
| | * Docker-Container für ASP.NET Core |
| | |
| | === Ressourcen === |
| | * Offizielle Dokumentation |
| | * Online-Tutorials und Kurse |
| | * Bücher und weiterführende Literatur |
| | |
| | == Fazit == |
| | * Zusammenfassung der wichtigsten Punkte |
| | * Nächste Schritte und weiterführende Themen |