- Improved documentation in DIExtensions.cs for clarity.
- Added project reference to DigitalData.Core.Exceptions.
- Updated solution file to include DigitalData.Core.Exceptions.
- Introduced ExceptionHandlingMiddleware for global exception handling.
- Added BadRequestException and NotFoundException classes.
- Created DigitalData.Core.Exceptions project with .NET 7.0, 8.0, and 9.0 support.
Added `[Obsolete("Use MediatR")]` attributes to various controller and service classes to indicate deprecation in favor of MediatR. Simplified generic type constraints in `CRUDControllerBase` and related files by removing `IUnique<TId>`. Improved structure and documentation in `CSPMiddleware.cs`. Introduced new extension methods in `EntityExtensions.cs` for safer retrieval of 'Id' properties. Removed `IUnique.cs` interface and updated project dependencies in `DigitalData.Core.Application.csproj` for caching. Overall, these changes enhance code maintainability and clarity.
The `ServiceResultExtensions` class has been removed from the
`DigitalData.Core.Abstractions` namespace. This class included a
static method `Try<T>` for handling nullable results, which has
now been eliminated. This change may indicate a refactoring
or a new approach to managing nullable results in the codebase.
This commit reorganizes namespaces from `DigitalData.Core.Abstractions` and `DigitalData.Core.DTO` to `DigitalData.Core.Application.Interfaces` and `DigitalData.Core.Application.DTO`, improving maintainability and clarity.
Updated using directives across multiple files to reflect the new structure, ensuring functionality remains intact.
Project references in `DigitalData.Core.API.csproj` have been consolidated to include the new Application project.
Introduced new classes and interfaces such as `BaseDTO`, `CookieConsentSettings`, `DataResult`, `Notice`, and `Result` to enhance data transfer and service result handling.
Updated `IRepository`, `ICRUDRepository`, and `IEntityMapper` interfaces to facilitate CRUD operations and entity mapping.
Added extension methods in `Extensions.cs` to improve repository usability.
New interfaces for HTTP client services have been added, enhancing external API call handling.
Overall, these changes reflect a significant restructuring aimed at improving organization and preparing for future development.
- Implementiert GetOptions<TOptions> zum Abrufen von Optionen oder null.
- Implementiert GetRequiredOptions<TOptions> für den Abruf von Optionen oder das Auslösen einer Ausnahme.
- Einführung einer neuen statischen Klasse ConfigurationExtension im Namespace DigitalData.Core.Abstractions.
- Hinzufügen der GetOrDefault-Erweiterungsmethode zu IConfiguration, die eine einfachere Abfrage von Konfigurationswerten mit Standardverhalten ermöglicht, wenn diese nicht gefunden werden.
- Aktualisierung der Versionsnummern auf 3.5.0 in den Projektdateien.
- Aktualisiert `CreateUserDtoFaker` um `UserCreateDto` anstelle von `UserDto` zu generieren.
- Die Klasse `UserDto` wurde entfernt, da sie nicht mehr benötigt wird.
- Hinzufügen von `UserCreateDto` für die Erstellung von Benutzern, Erweiterung von `UserBase`.
- Einführung von `UserReadDto` zum Lesen von Benutzerdaten, ebenfalls eine Erweiterung von `UserBase`.
- Aktualisierte `User` und `UserDto` Klassen um von einer neuen `UserBase` Klasse zu erben.
- Verschieben der Eigenschaften `Vorname`, `Email` und `Alter` zu `UserBase`.
- Implementierung der überschriebenen Methoden `GetHashCode` und `Equals` sowohl in `User` als auch in `UserDto`, um die Eigenschaften der Basisklasse zu nutzen.
Updated `DbRepositoryTests` to await `CreateAsync` directly for user creation. Changed assertion to compare the created user with the user retrieved from the repository, enhancing test accuracy.
Aktualisiert IRepository<TEntity> um UpdateAsync<TDto>, DeleteAsync<TDto> und eine neue Überladung von ReadAsync. Die frühere ReadAsync-Überladung für Core.Tests.Mock.User wurde entfernt.
Einführung einer neuen Extensions-Klasse mit Methoden für ReadFirstOrDefaultAsync, ReadFirstAsync, ReadSingleOrDefaultAsync und ReadSingleAsync unter Nutzung der aktualisierten ReadAsync-Methode.
- Added ReadAsync method to IRepository for user retrieval.
- Introduced _userRepo field in DbRepositoryTests for better clarity.
- Modified Setup method to initialize _userRepo from the service provider.
- Updated CreateAsync_ShouldNotThrow to use _userRepo.
- Added ReadAsync_ShouldReturnCreated test for user retrieval validation.
Die Testmethode `CreateAsync_ShouldPersistUser` wurde entfernt und `CreateAsync_ShouldNotThrow` mit Testfällen für die Erstellung einzelner und mehrerer Benutzer hinzugefügt. Die neue Methode prüft, dass `CreateAsync` keine Ausnahmen auslöst, während Benutzerdaten mit einem Faker erzeugt werden.
This commit introduces a new test method `CreateAsync_ShouldPersistUser` in `DbRepositoryTests.cs`. The method tests the asynchronous creation of a user in the repository using the `Faker` library to generate user data. It asserts that no exceptions are thrown during the creation process. Additionally, the using directives have been updated to include `DigitalData.Core.Abstractions.Infrastructure`.
This commit introduces a using directive for `System.Reflection` in `DbRepositoryTests.cs` to support reflection features. The `Setup` method is updated to include `AddAutoMapper`, ensuring AutoMapper services are registered for dependency injection in the test environment.
Modified `AddDbRepository` method to allow broader entity types and registered `queryFactory` as a singleton. Added necessary using directives in `DbRepositoryTests.cs` and updated the `Setup` method to configure an in-memory database for testing with `MockDbContext` and `User` entity.
Updated the `Fake` class to introduce flexible methods for generating fake `User` and `UserDto` objects with optional parameters. Removed the static `UserFaker` instance and related properties.
Added a new `DbSet<User>` property to `MockDbContext` for improved management of `User` entities.
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.