diff --git a/DotNetElements.sln b/DotNetElements.sln index 2846965..29f1338 100644 --- a/DotNetElements.sln +++ b/DotNetElements.sln @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetElements.CrudExample" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetElements.Core", "src\DotNetElements.Core\DotNetElements.Core.csproj", "{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetElements.Core.Test", "test\DotNetElements.Core.Test\DotNetElements.Core.Test.csproj", "{9BA47821-EBE3-4290-877B-FE75340AE33E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetElements.Core.Test", "test\DotNetElements.Core.Test\DotNetElements.Core.Test.csproj", "{9BA47821-EBE3-4290-877B-FE75340AE33E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetElements.AspNetCore", "src\DotNetElements.AspNetCore\DotNetElements.AspNetCore.csproj", "{83C7E815-7B9F-42A3-AA58-703234B6A4DB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {9BA47821-EBE3-4290-877B-FE75340AE33E}.Debug|Any CPU.Build.0 = Debug|Any CPU {9BA47821-EBE3-4290-877B-FE75340AE33E}.Release|Any CPU.ActiveCfg = Release|Any CPU {9BA47821-EBE3-4290-877B-FE75340AE33E}.Release|Any CPU.Build.0 = Release|Any CPU + {83C7E815-7B9F-42A3-AA58-703234B6A4DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83C7E815-7B9F-42A3-AA58-703234B6A4DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83C7E815-7B9F-42A3-AA58-703234B6A4DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83C7E815-7B9F-42A3-AA58-703234B6A4DB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/DotNetElements.CrudExample/DotNetElements.CrudExample.csproj b/samples/DotNetElements.CrudExample/DotNetElements.CrudExample.csproj index f323f4a..fb80064 100644 --- a/samples/DotNetElements.CrudExample/DotNetElements.CrudExample.csproj +++ b/samples/DotNetElements.CrudExample/DotNetElements.CrudExample.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -18,9 +18,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -28,6 +28,7 @@ + diff --git a/samples/DotNetElements.CrudExample/GlobalUsing.cs b/samples/DotNetElements.CrudExample/GlobalUsing.cs index 4e57da8..8cc5d32 100644 --- a/samples/DotNetElements.CrudExample/GlobalUsing.cs +++ b/samples/DotNetElements.CrudExample/GlobalUsing.cs @@ -6,4 +6,6 @@ global using Microsoft.Extensions.Options; global using DotNetElements.Core; -global using DotNetElements.Core.Extensions; \ No newline at end of file +global using DotNetElements.Core.Extensions; +global using DotNetElements.AspNetCore; +global using DotNetElements.AspNetCore.Extensions; \ No newline at end of file diff --git a/src/DotNetElements.AspNetCore/CurrentUserProviderWeb.cs b/src/DotNetElements.AspNetCore/CurrentUserProviderWeb.cs new file mode 100644 index 0000000..87badec --- /dev/null +++ b/src/DotNetElements.AspNetCore/CurrentUserProviderWeb.cs @@ -0,0 +1,20 @@ +using DotNetElements.Core; +using Microsoft.AspNetCore.Http; + +namespace DotNetElements.AspNetCore; + +public class CurrentUserProviderWeb : ICurrentUserProvider +{ + private readonly IHttpContextAccessor contextAccessor; + + public CurrentUserProviderWeb(IHttpContextAccessor contextAccessor) + { + this.contextAccessor = contextAccessor; + } + + // todo + public Guid GetCurrentUserId() + { + return new Guid("FF4F759C-0916-4611-9B66-306543A51B2A"); + } +} diff --git a/src/DotNetElements.AspNetCore/Directory.Build.props b/src/DotNetElements.AspNetCore/Directory.Build.props new file mode 100644 index 0000000..b4565b6 --- /dev/null +++ b/src/DotNetElements.AspNetCore/Directory.Build.props @@ -0,0 +1,7 @@ + + + + true + true + + \ No newline at end of file diff --git a/src/DotNetElements.AspNetCore/DotNetElements.AspNetCore.csproj b/src/DotNetElements.AspNetCore/DotNetElements.AspNetCore.csproj new file mode 100644 index 0000000..d3f10b7 --- /dev/null +++ b/src/DotNetElements.AspNetCore/DotNetElements.AspNetCore.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + + + + true + + + + + + + + + + + diff --git a/src/DotNetElements.AspNetCore/Extensions/ServiceCollectionExtensions.cs b/src/DotNetElements.AspNetCore/Extensions/ServiceCollectionExtensions.cs new file mode 100644 index 0000000..9a72f3e --- /dev/null +++ b/src/DotNetElements.AspNetCore/Extensions/ServiceCollectionExtensions.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using DotNetElements.Core; +using Microsoft.Extensions.DependencyInjection; + +namespace DotNetElements.AspNetCore.Extensions; + +public static class ServiceCollectionExtensions +{ + public static IReadOnlyList? RegisteredModules { get; private set; } + + public static IServiceCollection RegisterModules(this IServiceCollection services, Assembly moduleAssembly) + { + IEnumerable modules = DiscoverModules(moduleAssembly); + List registeredModules = []; + + foreach (IModule module in modules) + { + module.RegisterModules(services); + registeredModules.Add(module); + } + + RegisteredModules = registeredModules; + + return services; + } + + // todo replace with source generated version + private static IEnumerable DiscoverModules(Assembly moduleAssembly) + { + return moduleAssembly.GetTypes() + .Where(p => p.IsAssignableTo(typeof(IModule)) && p.IsClass && !p.IsAbstract) + .Select(Activator.CreateInstance) + .Cast(); + } +} diff --git a/src/DotNetElements.Core/Core/Extensions/WebApplicationBuilderExtensions.cs b/src/DotNetElements.AspNetCore/Extensions/WebApplicationBuilderExtensions.cs similarity index 81% rename from src/DotNetElements.Core/Core/Extensions/WebApplicationBuilderExtensions.cs rename to src/DotNetElements.AspNetCore/Extensions/WebApplicationBuilderExtensions.cs index 415187f..8197615 100644 --- a/src/DotNetElements.Core/Core/Extensions/WebApplicationBuilderExtensions.cs +++ b/src/DotNetElements.AspNetCore/Extensions/WebApplicationBuilderExtensions.cs @@ -1,7 +1,8 @@ -using Microsoft.AspNetCore.Builder; +using DotNetElements.Core; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -namespace DotNetElements.Core.Extensions; +namespace DotNetElements.AspNetCore.Extensions; public static class WebApplicationBuilderExtensions { diff --git a/src/DotNetElements.Core/Core/Extensions/WebApplicationExtensions.cs b/src/DotNetElements.AspNetCore/Extensions/WebApplicationExtensions.cs similarity index 90% rename from src/DotNetElements.Core/Core/Extensions/WebApplicationExtensions.cs rename to src/DotNetElements.AspNetCore/Extensions/WebApplicationExtensions.cs index 7d94594..cc9db38 100644 --- a/src/DotNetElements.Core/Core/Extensions/WebApplicationExtensions.cs +++ b/src/DotNetElements.AspNetCore/Extensions/WebApplicationExtensions.cs @@ -1,7 +1,8 @@ using Microsoft.AspNetCore.Builder; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace DotNetElements.Core.Extensions; +namespace DotNetElements.AspNetCore.Extensions; public static class WebApplicationExtensions { diff --git a/src/DotNetElements.AspNetCore/GlobalUsing.cs b/src/DotNetElements.AspNetCore/GlobalUsing.cs new file mode 100644 index 0000000..2e62d31 --- /dev/null +++ b/src/DotNetElements.AspNetCore/GlobalUsing.cs @@ -0,0 +1 @@ +global using DotNetElements.Core; \ No newline at end of file diff --git a/src/DotNetElements.Core/Core/IModule.cs b/src/DotNetElements.AspNetCore/IModule.cs similarity index 87% rename from src/DotNetElements.Core/Core/IModule.cs rename to src/DotNetElements.AspNetCore/IModule.cs index a127155..88c907f 100644 --- a/src/DotNetElements.Core/Core/IModule.cs +++ b/src/DotNetElements.AspNetCore/IModule.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; -namespace DotNetElements.Core; +namespace DotNetElements.AspNetCore; public interface IModule { diff --git a/src/DotNetElements.Core/Core/Result/CrudResultExtensions.cs b/src/DotNetElements.AspNetCore/Result/CrudResultExtensions.cs similarity index 97% rename from src/DotNetElements.Core/Core/Result/CrudResultExtensions.cs rename to src/DotNetElements.AspNetCore/Result/CrudResultExtensions.cs index 8a93370..4b953ab 100644 --- a/src/DotNetElements.Core/Core/Result/CrudResultExtensions.cs +++ b/src/DotNetElements.AspNetCore/Result/CrudResultExtensions.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Http; using IHttpResult = Microsoft.AspNetCore.Http.IResult; -namespace DotNetElements.Core; +namespace DotNetElements.AspNetCore; public static class CrudResultExtensions { diff --git a/src/DotNetElements.Core/Core/CurrentUserProviderWeb.cs b/src/DotNetElements.Core/Core/CurrentUserProviderWeb.cs deleted file mode 100644 index 3ae6609..0000000 --- a/src/DotNetElements.Core/Core/CurrentUserProviderWeb.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.AspNetCore.Http; - -namespace DotNetElements.Core; - -public class CurrentUserProviderWeb : ICurrentUserProvider -{ - private readonly IHttpContextAccessor contextAccessor; - - public CurrentUserProviderWeb(IHttpContextAccessor contextAccessor) - { - this.contextAccessor = contextAccessor; - } - - // todo - public Guid GetCurrentUserId() - { - return new Guid("FF4F759C-0916-4611-9B66-306543A51B2A"); - } -} diff --git a/src/DotNetElements.Core/Core/Extensions/ServiceCollectionExtensions.cs b/src/DotNetElements.Core/Core/Extensions/ServiceCollectionExtensions.cs index 10ca05e..8f9edf7 100644 --- a/src/DotNetElements.Core/Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/DotNetElements.Core/Core/Extensions/ServiceCollectionExtensions.cs @@ -5,24 +5,6 @@ namespace DotNetElements.Core.Extensions; public static class ServiceCollectionExtensions { - public static IReadOnlyList? RegisteredModules { get; private set; } - - public static IServiceCollection RegisterModules(this IServiceCollection services, Assembly moduleAssembly) - { - IEnumerable modules = DiscoverModules(moduleAssembly); - List registeredModules = []; - - foreach (IModule module in modules) - { - module.RegisterModules(services); - registeredModules.Add(module); - } - - RegisteredModules = registeredModules; - - return services; - } - public static IServiceCollection AddManagedRepository(this IServiceCollection services) where TEntity : Entity where TKey : notnull, IEquatable @@ -42,13 +24,4 @@ public static IServiceCollection AddDatabaseMigrationService(this IS return services; } - - // todo replace with source generated version - private static IEnumerable DiscoverModules(Assembly moduleAssembly) - { - return moduleAssembly.GetTypes() - .Where(p => p.IsAssignableTo(typeof(IModule)) && p.IsClass && !p.IsAbstract) - .Select(Activator.CreateInstance) - .Cast(); - } } diff --git a/src/DotNetElements.Core/Core/IRepository.cs b/src/DotNetElements.Core/Core/IRepository.cs index da96c1f..b70b511 100644 --- a/src/DotNetElements.Core/Core/IRepository.cs +++ b/src/DotNetElements.Core/Core/IRepository.cs @@ -14,7 +14,7 @@ Task> CreateOrUpdateAsync(TKey id, TSelf entity, Expres where TSelf : Entity, IUpdatable; Task DeleteAsync(TEntityToDelete entityToDelete) - where TEntityToDelete : IHasKey, IHasVersionReadOnly; + where TEntityToDelete : IHasKey; Task> UpdateAsync(TKey id, TFrom from) where TUpdatableEntity : Entity, IUpdatable diff --git a/src/DotNetElements.Core/Core/IScopedRepositoryFactory.cs b/src/DotNetElements.Core/Core/IScopedRepositoryFactory.cs index e1e1342..f5ac403 100644 --- a/src/DotNetElements.Core/Core/IScopedRepositoryFactory.cs +++ b/src/DotNetElements.Core/Core/IScopedRepositoryFactory.cs @@ -3,7 +3,7 @@ public interface IScopedRepositoryFactory where TEntity : Entity where TKey : notnull, IEquatable - where TRepository : IRepository + where TRepository : IReadOnlyRepository { ScopedRepository Create(); } \ No newline at end of file diff --git a/src/DotNetElements.Core/Core/ManagedReadOnlyRepository.cs b/src/DotNetElements.Core/Core/ManagedReadOnlyRepository.cs new file mode 100644 index 0000000..1bcd517 --- /dev/null +++ b/src/DotNetElements.Core/Core/ManagedReadOnlyRepository.cs @@ -0,0 +1,107 @@ +using System.Linq.Expressions; + +namespace DotNetElements.Core; + +public abstract class ManagedReadOnlyRepository : IReadOnlyRepository + where TEntity : Entity + where TKey : notnull, IEquatable + where TRepository : IReadOnlyRepository +{ + protected readonly IScopedRepositoryFactory RepositoryFactory; + + public ManagedReadOnlyRepository(IScopedRepositoryFactory repositoryFactory) + { + this.RepositoryFactory = repositoryFactory; + } + + public Task> GetAllAsync(CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAllAsync(cancellationToken); + } + + public Task> GetAllFilteredAsync( + Expression>? filter = null, + Expression>? orderBy = null, + bool descending = true, + CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAllFilteredAsync(filter, orderBy, descending, cancellationToken); + } + + public Task> GetAllPagedAsync( + Expression>? filter = null, + Expression>? orderBy = null, + bool descending = true, + int page = 1, + int pageSize = int.MaxValue, + CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAllPagedAsync(filter, orderBy, descending, page, pageSize, cancellationToken); + } + + public Task> GetAllPagedWithProjectionAsync( + Expression, IQueryable>> selector, + Expression>? filter = null, + Expression>? orderBy = null, + bool descending = true, + int page = 1, + int pageSize = int.MaxValue, + CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAllPagedWithProjectionAsync(selector, filter, orderBy, descending, page, pageSize, cancellationToken); + } + + public Task> GetAllWithProjectionAsync( + Expression, + IQueryable>> selector, + Expression>? filter = null, + Expression>? orderBy = null, + bool descending = true, + CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAllWithProjectionAsync(selector, filter, orderBy, descending, cancellationToken); + } + + public Task> GetByIdAsync(TKey id, CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetByIdAsync(id, cancellationToken); + } + + public Task> GetByIdFilteredAsync(TKey id, Expression>? filter = null, CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetByIdFilteredAsync(id, filter, cancellationToken); + } + + public Task> GetByIdWithProjectionAsync( + TKey id, + Expression, IQueryable>> selector, + Expression>? filter = null, + CancellationToken cancellationToken = default) + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetByIdWithProjectionAsync(id, selector, filter, cancellationToken); + } + + public Task> GetAuditedModelDetailsByIdAsync(TKey id, CancellationToken cancellationToken = default) + where TAuditedEntity : AuditedEntity + { + using var repository = RepositoryFactory.Create(); + + return repository.Inner.GetAuditedModelDetailsByIdAsync(id, cancellationToken); + } +} diff --git a/src/DotNetElements.Core/Core/ManagedRepository.cs b/src/DotNetElements.Core/Core/ManagedRepository.cs index e345414..de26dbf 100644 --- a/src/DotNetElements.Core/Core/ManagedRepository.cs +++ b/src/DotNetElements.Core/Core/ManagedRepository.cs @@ -2,21 +2,18 @@ namespace DotNetElements.Core; -public abstract class ManagedRepository : IRepository +public abstract class ManagedRepository : ManagedReadOnlyRepository, IRepository where TEntity : Entity where TKey : notnull, IEquatable where TRepository : IRepository { - private readonly IScopedRepositoryFactory repositoryFactory; - - public ManagedRepository(IScopedRepositoryFactory repositoryFactory) + public ManagedRepository(IScopedRepositoryFactory repositoryFactory) : base(repositoryFactory) { - this.repositoryFactory = repositoryFactory; } public Task> CreateAsync(TEntity entity, Expression>? checkDuplicate = null) { - using var repository = repositoryFactory.Create(); + using var repository = RepositoryFactory.Create(); return repository.Inner.CreateAsync(entity, checkDuplicate); } @@ -24,123 +21,32 @@ public Task> CreateAsync(TEntity entity, Expression> CreateOrUpdateAsync(TKey id, TSelf entity, Expression>? checkDuplicate = null) where TSelf : Entity, IUpdatable { - using var repository = repositoryFactory.Create(); + using var repository = RepositoryFactory.Create(); return repository.Inner.CreateOrUpdateAsync(id, entity, checkDuplicate); } public Task DeleteAsync(TEntityToDelete entityToDelete) - where TEntityToDelete : IHasKey, IHasVersionReadOnly + where TEntityToDelete : IHasKey { - using var repository = repositoryFactory.Create(); + using var repository = RepositoryFactory.Create(); return repository.Inner.DeleteAsync(entityToDelete); } - public Task> GetAllAsync(CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAllAsync(cancellationToken); - } - - public Task> GetAllFilteredAsync( - Expression>? filter = null, - Expression>? orderBy = null, - bool descending = true, - CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAllFilteredAsync(filter, orderBy, descending, cancellationToken); - } - - public Task> GetAllPagedAsync( - Expression>? filter = null, - Expression>? orderBy = null, - bool descending = true, - int page = 1, - int pageSize = int.MaxValue, - CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAllPagedAsync(filter, orderBy, descending, page, pageSize, cancellationToken); - } - - public Task> GetAllPagedWithProjectionAsync( - Expression, IQueryable>> selector, - Expression>? filter = null, - Expression>? orderBy = null, - bool descending = true, - int page = 1, - int pageSize = int.MaxValue, - CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAllPagedWithProjectionAsync(selector, filter, orderBy, descending, page, pageSize, cancellationToken); - } - - public Task> GetAllWithProjectionAsync( - Expression, - IQueryable>> selector, - Expression>? filter = null, - Expression>? orderBy = null, - bool descending = true, - CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAllWithProjectionAsync(selector, filter, orderBy, descending, cancellationToken); - } - - public Task> GetByIdAsync(TKey id, CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetByIdAsync(id, cancellationToken); - } - - public Task> GetByIdFilteredAsync(TKey id, Expression>? filter = null, CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetByIdFilteredAsync(id, filter, cancellationToken); - } - - public Task> GetByIdWithProjectionAsync( - TKey id, - Expression, IQueryable>> selector, - Expression>? filter = null, - CancellationToken cancellationToken = default) - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetByIdWithProjectionAsync(id, selector, filter, cancellationToken); - } - public Task> UpdateAsync(TKey id, TFrom from) where TUpdatableEntity : Entity, IUpdatable where TFrom : notnull { - using var repository = repositoryFactory.Create(); + using var repository = RepositoryFactory.Create(); return repository.Inner.UpdateAsync(id, from); } public Task ClearTable() { - using var repository = repositoryFactory.Create(); + using var repository = RepositoryFactory.Create(); return repository.Inner.ClearTable(); } - - public Task> GetAuditedModelDetailsByIdAsync(TKey id, CancellationToken cancellationToken = default) - where TAuditedEntity : AuditedEntity - { - using var repository = repositoryFactory.Create(); - - return repository.Inner.GetAuditedModelDetailsByIdAsync(id, cancellationToken); - } } diff --git a/src/DotNetElements.Core/Core/Repository.cs b/src/DotNetElements.Core/Core/Repository.cs index ac8b8fc..21c7499 100644 --- a/src/DotNetElements.Core/Core/Repository.cs +++ b/src/DotNetElements.Core/Core/Repository.cs @@ -61,7 +61,7 @@ public virtual async Task> CreateOrUpdateAsync(TKey id, auditedEntity.SetCreationAudited(CurrentUserProvider.GetCurrentUserId(), TimeProvider.GetUtcNow()); var createdEntity = DbContext.Set().Attach(entity); - + await DbContext.SaveChangesAsync(); return createdEntity.Entity; @@ -133,7 +133,7 @@ public virtual async Task> UpdateAsync DeleteAsync(TEntityToDelete entityToDelete) - where TEntityToDelete : IHasKey, IHasVersionReadOnly + where TEntityToDelete : IHasKey { TEntity? existingEntity = await Entities.FirstOrDefaultAsync(WithId(entityToDelete.Id)); @@ -144,19 +144,19 @@ public virtual async Task DeleteAsync(TEntityToDele { deletionAuditedEntity.Delete(CurrentUserProvider.GetCurrentUserId(), TimeProvider.GetUtcNow()); - UpdateEntityVersion(existingEntity, entityToDelete.Version); + UpdateEntityVersion(existingEntity, entityToDelete); } else if (existingEntity is IHasDeletionTime entityWithDeletionTime) { entityWithDeletionTime.Delete(TimeProvider.GetUtcNow()); - UpdateEntityVersion(existingEntity, entityToDelete.Version); + UpdateEntityVersion(existingEntity, entityToDelete); } else if (existingEntity is ISoftDelete softDeletableEntity) { softDeletableEntity.Delete(); - UpdateEntityVersion(existingEntity, entityToDelete.Version); + UpdateEntityVersion(existingEntity, entityToDelete); } else { diff --git a/src/DotNetElements.Core/Core/ScopedRepository.cs b/src/DotNetElements.Core/Core/ScopedRepository.cs index 42883a7..7d97460 100644 --- a/src/DotNetElements.Core/Core/ScopedRepository.cs +++ b/src/DotNetElements.Core/Core/ScopedRepository.cs @@ -5,7 +5,7 @@ namespace DotNetElements.Core; public sealed class ScopedRepository : IDisposable where TEntity : Entity where TKey : notnull, IEquatable - where TRepository : IRepository + where TRepository : IReadOnlyRepository { public TRepository Inner { get; private init; } diff --git a/src/DotNetElements.Core/DotNetElements.Core.csproj b/src/DotNetElements.Core/DotNetElements.Core.csproj index a45fb44..2c1f6cc 100644 --- a/src/DotNetElements.Core/DotNetElements.Core.csproj +++ b/src/DotNetElements.Core/DotNetElements.Core.csproj @@ -10,10 +10,6 @@ true - - - -