Updated the `Static` class in the `DigitalData.Core.Infrastructure` namespace to a generic version `Static<TEntity>`. Removed the original non-generic class and the `GetRepository<TEntity>` method. The new generic class provides a method to retrieve a repository for a specific entity type `TEntity`, enhancing type safety and usability.
Updated the exception message in the `Static` class to clarify that services cannot be accessed after the service provider has been created. This change enhances the clarity of the error for developers.
This commit introduces two new properties in the `Static` class: `Repository` and `GetRepository<TEntity>()`. The `Repository` property allows retrieval of an `IRepository` instance from the service provider, while `GetRepository<TEntity>()` provides access to a specific `IRepository<TEntity>`. These additions improve the ease of accessing repository instances for data operations.
Introduce framework-specific handling in `Static.cs` to support both NET and NETFRAMEWORK. Implement lazy initialization for service collection and provider, ensuring proper access and error handling.
Updated code to support conditional compilation for .NET Framework and .NET.
Introduced nullable reference types in `DbRepository.cs` and ensured proper initialization of service registration queues in `DependencyInjection.cs`.
Modified `DbRepositoryFactory.cs` and `DbSetFactory.cs` to maintain consistent structure across frameworks.
These changes enhance compatibility and improve type safety.
Added preprocessor directive for NET framework support.
Updated using directives to include repository and EF Core
namespaces. Adjusted code structure for improved compatibility.
Updated `DigitalData.Core.Infrastructure.csproj` to include .NET Framework version 4.6.2 alongside net7.0, net8.0, and net9.0. Configured framework-specific settings for nullable reference types, implicit usings, and language versions. Added a new `<ItemGroup>` for net462 to reference `Microsoft.EntityFrameworkCore` version 3.1.32.
- Updated Where() to use AsNoTracking() for read-only queries
- Added GetAll() and GetAllAsync() to retrieve all entities
- Improved repository methods for efficient read operations
- Updated DbRepository constructor to use DbSetFactory<TDbContext, TEntity>
instead of a Func<TDbContext, DbSet<TEntity>> queryFactory.
- Adjusted namespace imports to include DigitalData.Core.Infrastructure.Factory.
- Improved repository instantiation consistency and encapsulation.
- Added `RegisterAllServices` method to centralize service registration
- Introduced `RegsDbSetFactory` queue for custom DbSetFactory registrations
- Extended `RegisterEntity` to support optional DbSetFactory
- Added `RegisterDbSetFactory` for explicit DbSetFactory registration
- Registered `IRepositoryFactory` with `DbRepositoryFactory` in DI
- Introduced AddDbSetFactory to support DbSet factory registration for entities.
- Updated RepositoryConfiguration.RegisterFromAssembly to register both repositories and DbSet factories.
- Changed RegisterFromAssembly and RegisterEntity to void methods instead of fluent interface.
- Extracted DbRepositoryFactory into its own Factory namespace for better separation of concerns.
- Replaced `AddDbRepository<TDbContext, TEntity>` with `AddDbRepository(Action<RepositoryConfiguration>)` for more flexible DI registration.
- Added `RepositoryConfiguration` class to support:
- Registering repositories from an assembly (`RegisterFromAssembly`)
- Registering individual entities (`RegisterEntity`)
- Queues (`RegsFromAssembly` and `RegsEntity`) are used to defer registration until `InvokeAll` is called.
- Allows overriding and scanning multiple entities dynamically instead of static generic method.
- Renamed `Read()` to `Where()` and `ReadOnly()` to `Get()` for clarity.
- Marked old `Read()` and `ReadOnly()` methods as `[Obsolete]` with guidance to use the new methods.
- Updated XML region to separate obsolete methods for better maintainability.
Changed UpdateAsync and DeleteAsync to accept Func<IQueryable<TEntity>, IQueryable<TEntity>> instead of IQueryable<TEntity>
Improved flexibility by allowing callers to compose queries dynamically
Updated overloads to wrap expressions with q => q.Where(expression) for compatibility
Updated the `Microsoft.EntityFrameworkCore` package version
from `9.0.4` to `9.0.5` for the target framework `net9.0`
in the `DigitalData.Core.Infrastructure.csproj` file.
- Added net9.0 to target frameworks.
- Updated package description to reference DigitalData.Core.Application.
- Incremented version to 2.1.0 for package, assembly, and file versions.
- Changed package icon path to `..\Assets\core_icon.png`.
Updated `IRepository<TEntity>` to introduce new reading methods and mark existing ones as obsolete. The `CRUDRepository` class is now deprecated, encouraging a transition to alternative implementations. Significant changes in `DbRepository<TDbContext, TEntity>` include the removal of old read methods in favor of a new `Read` method returning `IReadQuery<TEntity>`. Added a `ReadQuery<TEntity>` class to enhance querying capabilities with a fluent API. Obsolete methods are organized under a `#region Obsolete` directive for better management.
- Added using directives for new application interfaces.
- Removed constraint for IUnique<TId> from TEntity.
- Updated CountAsync method to use GetId() for identifier retrieval.
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.