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:
13
DigitalData.Core.Infrastructure/Factory/DbSetFactory.cs
Normal file
13
DigitalData.Core.Infrastructure/Factory/DbSetFactory.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user