feat(infrastructure): add DbSetFactory registration in DependencyInjection

- 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.
This commit is contained in:
2025-09-11 17:20:47 +02:00
parent 33f7ced3b2
commit 90a12f52bc
3 changed files with 40 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
namespace DigitalData.Core.Infrastructure.Factory;
public class DbSetFactory<TDbContext,TEntity> where TDbContext : DbContext where TEntity : class
{
public readonly Func<TDbContext, DbSet<TEntity>> Create;
public DbSetFactory(Func<TDbContext, DbSet<TEntity>> create)
{
Create = create;
}
}