Initial .NET 8 Web API with EF Core Db-First for Catalogs
Set up multi-project solution with DbFirst API, Application, Domain, and Infrastructure layers. Implemented database-first EF Core for the Catalog entity, including domain, DTOs, repository, service, and controller. Configured AutoMapper, DI, Swagger, and project settings. Added .gitattributes and initial configuration files.
This commit is contained in:
24
DbFirst.Infrastructure/ScaffoldEntities/TbmyCatalog.cs
Normal file
24
DbFirst.Infrastructure/ScaffoldEntities/TbmyCatalog.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace DbFirst.Infrastructure.ScaffoldEntities;
|
||||
|
||||
public partial class TbmyCatalog
|
||||
{
|
||||
public int Guid { get; set; }
|
||||
|
||||
public string CatTitle { get; set; } = null!;
|
||||
|
||||
public string CatString { get; set; } = null!;
|
||||
|
||||
public string AddedWho { get; set; } = null!;
|
||||
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
public string? ChangedWho { get; set; }
|
||||
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
// = null!; ist nur eine Null-Unterdrückung für Non‑Nullable-Referenztypen. Hintergrund: Die Spalten CatTitle, CatString, AddedWho
|
||||
// sind in der DB als NOT NULL definiert, also generiert der Scaffold string (ohne ?). Damit der Compiler bei aktivierter Nullable-Analyse
|
||||
// nicht warnt („non-nullable property is uninitialized“), wird ein Dummy-Init auf null! gesetzt. Das ! sagt dem Compiler „ich garantiere,
|
||||
// dass zur Laufzeit ein Wert gesetzt wird“. Bei string? ChangedWho/DateTime? ChangedWhen sind die Spalten nullable, daher kein null! nötig.
|
||||
// Bei Value Types wie int/DateTime braucht es ebenfalls kein Init, da sie Standardwerte haben.
|
||||
}
|
||||
Reference in New Issue
Block a user