Add conditional compilation for .NET Framework support
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.
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.Core.Infrastructure.Factory;
|
||||
namespace DigitalData.Core.Infrastructure.Factory
|
||||
#if NET
|
||||
;
|
||||
#elif NETFRAMEWORK
|
||||
{
|
||||
#endif
|
||||
|
||||
public class DbRepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
@@ -13,4 +21,8 @@ public class DbRepositoryFactory : IRepositoryFactory
|
||||
}
|
||||
|
||||
public IRepository<TEntity> Get<TEntity>() => _provider.GetRequiredService<IRepository<TEntity>>();
|
||||
}
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
}
|
||||
#endif
|
||||
@@ -1,6 +1,14 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.Core.Infrastructure.Factory;
|
||||
namespace DigitalData.Core.Infrastructure.Factory
|
||||
#if NET
|
||||
;
|
||||
#elif NETFRAMEWORK
|
||||
{
|
||||
#endif
|
||||
|
||||
public class DbSetFactory<TDbContext,TEntity> where TDbContext : DbContext where TEntity : class
|
||||
{
|
||||
@@ -10,4 +18,8 @@ public class DbSetFactory<TDbContext,TEntity> where TDbContext : DbContext where
|
||||
{
|
||||
Create = create;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user