Aktualisiert `DigitalData.Core.Tests.csproj`, um `Bogus` zur Erzeugung gefälschter Daten einzuschließen. Fake.cs„ für die Erstellung von gefälschten “User"-Objekten hinzugefügt. MockDbContext" für das Testen von Datenbank-Interaktionen eingeführt. Definierte `User` und `UserDto` Klassen für die Benutzerdarstellung und Datenübertragung.
Updated `DigitalData.Core.Tests.csproj` to include conditional
package references for Entity Framework Core and its InMemory
provider for net7.0, net8.0, and net9.0.
Added `DbRepositoryTests` class with setup and teardown
methods for managing the lifecycle of a host instance.
Der Projektmappendatei `DigitalData.Core.sln` wurden zwei neue Projekte mit den Namen "src" und "tests" hinzugefügt. Das Projekt „src“ hat einen eindeutigen Bezeichner `{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}`, und das Projekt „tests“ hat den Bezeichner `{EDF84A84-1E01-484E-B073-383F7139C891}`. Darüber hinaus wurden in den Lösungseigenschaften mehrere verschachtelte Projektbeziehungen eingerichtet, die diese neuen Projekte mit den bestehenden Projekten verknüpfen.
Updated IRepository<TEntity> to include new generic methods for creating and reading entities from DTOs. Modified UpdateAsync to accept DTOs instead of generic types. Implemented corresponding methods in DbRepository<TDbContext, TEntity> for mapping DTOs to entities during creation and updating processes.
Updated the `IRepository<TEntity>` interface to include two new mapping methods: `Map<TSource>(TSource source)` and `Map<TDto>(TEntity source)`.
Implemented these methods in the `DbRepository<TDbContext, TEntity>` class, utilizing a `Mapper` for conversions between source types and entity types, as well as between entity types and DTOs.
- Incremented version numbers in project files for updates.
- Marked `ICRUDRepository` as obsolete; use `IRepository` instead.
- Improved parameter names and signatures in `IRepository`.
- Changed access modifiers in `DbRepository` for broader access.
- Updated `CreateAsync` and `UpdateAsync` methods for async operations.
- Implemented `ReadAsync` and `DeleteAsync` methods in `DbRepository`.
- Minor whitespace change in `.csproj` files.
- Retained package description in `DigitalData.Core.Infrastructure.csproj`.
- Added conditional package references for AutoMapper in
`DigitalData.Core.Application.csproj` to support
different target framework versions.
- Changed `DbRepository` class access modifier from
`public` to `internal` to encapsulate implementation
details within the current assembly.
The project file `DigitalData.Core.Infrastructure.csproj` has been modified to include conditional `PackageReference` entries for different target frameworks. The previous reference to `Microsoft.EntityFrameworkCore` version `7.0.16` has been replaced with:
- version `7.0.20` for `net7.0`
- version `8.0.15` for `net8.0`
- version `9.0.4` for `net9.0`
This change ensures the project uses the appropriate version of Entity Framework Core based on the target framework.
Updated methods in the `DbRepository` class to be virtual, allowing for overriding in derived classes. Renamed parameters from `dto` to `entity` and `dtos` to `entities` for improved clarity. All methods still throw `NotImplementedException` as implementations are pending.
Added AutoMapper support by introducing an IMapper field.
Changed Context and Entities fields to readonly for better
encapsulation. Updated constructor to accept an IMapper
parameter, improving object mapping capabilities.
Updated IRepository<TEntity> to remove generic type parameters
from CreateAsync methods, now directly accepting TEntity.
Corresponding changes made in DbRepository to align method
signatures. Implementations still throw NotImplementedException.
Updated the IRepository<TEntity> interface to include an optional CancellationToken parameter in the asynchronous methods: CreateAsync, ReadAsync, UpdateAsync, and DeleteAsync. Modified the DbRepository<TDbContext, TEntity> class to align with these changes, ensuring method signatures are consistent with the interface.
This commit introduces a new `DbRepository` class implementing the `IRepository<TEntity>` interface, providing asynchronous methods for CRUD operations. The previous CRUD repository registration in `DIExtensions.cs` has been removed, indicating a shift in repository management. A new static class `DependencyInjection` has been added to facilitate the registration of `DbRepository` with the service collection, enhancing modularity and flexibility in database interactions.
Die `ICRUDRepository`-Schnittstelle wurde als veraltet markiert, was bedeutet, dass sie zugunsten der neuen `IRepository`-Schnittstelle abgelehnt wird. Die „IRepository“-Schnittstelle bietet eine verbesserte Abstraktion und Flexibilität, die Methoden zum Erstellen, Lesen, Aktualisieren und Löschen von Entitäten mit Unterstützung für asynchrone Operationen umfasst.
Updated multiple project files to support .NET 9.0 alongside .NET 7.0 and .NET 8.0. Affected files include:
- DigitalData.Core.API.csproj
- DigitalData.Core.Abstractions.csproj
- DigitalData.Core.Application.csproj
- DigitalData.Core.Client.csproj
- DigitalData.Core.DTO.csproj
- DigitalData.Core.Infrastructure.csproj
This change enables the use of new features and improvements in .NET 9.0.
- Hinzufügen der erforderlichen Metadaten zur Projektdatei für die Erstellung eines NuGet-Pakets, einschließlich PackageId, Versionsdetails, Autorenschaft, Urheberrecht, Beschreibung und Repository-Informationen. Außerdem wurde eine Icon-Referenz für eine verbesserte Paketdarstellung hinzugefügt.
- Die Logger-Inject-Funktion wurde obligatorisch gemacht.
- Der try catch-Blog wurde so konfiguriert, dass die Ausnahme in jedem Fall protokolliert wird.