Browse Source

Temporary remove default PK entity, repository, agg root etc.

pull/194/head
Halil İbrahim Kalkan 9 years ago
parent
commit
f66ca10231
  1. 4
      src/AbpDesk/AbpDesk.ConsoleDemo/AbpDesk/ConsoleDemo/BlogPostLister.cs
  2. 4
      src/AbpDesk/AbpDesk.ConsoleDemo/AbpDesk/ConsoleDemo/UserLister.cs
  3. 5
      src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs
  4. 7
      src/AbpDesk/AbpDesk.MongoBlog/Areas/Blog/Controllers/PostsController.cs
  5. BIN
      src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll
  6. 50
      src/Volo.Abp.Ddd/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
  7. 1
      src/Volo.Abp.Ddd/Volo/Abp/Application/Services/CrudAppServiceBase.cs
  8. 8
      src/Volo.Abp.Ddd/Volo/Abp/Application/Services/IAsyncCrudAppService.cs
  9. 8
      src/Volo.Abp.Ddd/Volo/Abp/DependencyInjection/CommonDbContextRegistrationOptions.cs
  10. 3
      src/Volo.Abp.Ddd/Volo/Abp/DependencyInjection/ICommonDbContextRegistrationOptionsBuilder.cs
  11. 6
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/AggregateRoot.cs
  12. 12
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs
  13. 6
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IAggregateRoot.cs
  14. 12
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs
  15. 8
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/IQueryableRepository.cs
  16. 8
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/IRepository.cs
  17. 8
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/QueryableRepositoryBase.cs
  18. 8
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/RepositoryBase.cs
  19. 18
      src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs
  20. 18
      src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
  21. 8
      src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/IEfCoreRepository.cs
  22. 8
      src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/EfCoreRepositoryRegistrar.cs
  23. 8
      src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/IMemoryDbRepository.cs
  24. 18
      src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs
  25. 5
      src/Volo.Abp.MemoryDb/Volo/Abp/MemoryDb/DependencyInjection/MemoryDbRepositoryRegistrar.cs
  26. 8
      src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs
  27. 18
      src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  28. 5
      src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/DependencyInjection/MongoDbRepositoryRegistrar.cs
  29. 4
      test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
  30. 60
      test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs
  31. 4
      test/Volo.Abp.Identity.Tests/Volo/Abp/Identity/Initialize_Tests.cs
  32. 7
      test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/DataFilters/MemoryDb_SoftDelete_DataFilter_Tests.cs
  33. 4
      test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/Repositories/MemoryDb_Basic_Repository_Tests.cs
  34. 2
      test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs
  35. 2
      test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs

4
src/AbpDesk/AbpDesk.ConsoleDemo/AbpDesk/ConsoleDemo/BlogPostLister.cs

@ -9,11 +9,11 @@ namespace AbpDesk.ConsoleDemo
{
public class BlogPostLister : ITransientDependency
{
private readonly IQueryableRepository<BlogPost> _blogPostRepository;
private readonly IQueryableRepository<BlogPost, Guid> _blogPostRepository;
private readonly IGuidGenerator _guidGenerator;
public BlogPostLister(
IQueryableRepository<BlogPost> blogPostRepository,
IQueryableRepository<BlogPost, Guid> blogPostRepository,
IGuidGenerator guidGenerator)
{
_blogPostRepository = blogPostRepository;

4
src/AbpDesk/AbpDesk.ConsoleDemo/AbpDesk/ConsoleDemo/UserLister.cs

@ -11,11 +11,11 @@ namespace AbpDesk.ConsoleDemo
public class UserLister : ITransientDependency
{
private readonly IdentityUserManager _userManager;
private readonly IQueryableRepository<IdentityUser> _userRepository;
private readonly IQueryableRepository<IdentityUser, Guid> _userRepository;
public UserLister(
IdentityUserManager userManager,
IQueryableRepository<IdentityUser> userRepository)
IQueryableRepository<IdentityUser, Guid> userRepository)
{
_userManager = userManager;
_userRepository = userRepository;

5
src/AbpDesk/AbpDesk.MongoBlog/AbpDesk/Blogging/AbpDeskMongoBlogModule.cs

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp;
@ -46,7 +47,7 @@ namespace AbpDesk.Blogging
using (var uow = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>().Begin())
{
var blogPostRepository = scope.ServiceProvider.GetRequiredService<IQueryableRepository<BlogPost>>();
var blogPostRepository = scope.ServiceProvider.GetRequiredService<IQueryableRepository<BlogPost, Guid>>();
if (blogPostRepository.Any())
{
logger.LogInformation($"No need to seed database since there are already {blogPostRepository.Count()} blog posts!");

7
src/AbpDesk/AbpDesk.MongoBlog/Areas/Blog/Controllers/PostsController.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using AbpDesk.Blogging;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
@ -9,9 +10,9 @@ namespace Areas.Blog.Controllers
[Area("Blog")]
public class PostsController : AbpController
{
private readonly IQueryableRepository<BlogPost> _blogPostRepository;
private readonly IQueryableRepository<BlogPost, Guid> _blogPostRepository;
public PostsController(IQueryableRepository<BlogPost> blogPostRepository)
public PostsController(IQueryableRepository<BlogPost, Guid> blogPostRepository)
{
_blogPostRepository = blogPostRepository;
}

BIN
src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll

Binary file not shown.

50
src/Volo.Abp.Ddd/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs

@ -14,10 +14,10 @@ namespace Microsoft.Extensions.DependencyInjection
{
AddDefaultRepositoryForGenericPrimaryKey(services, entityType, repositoryImplementationType);
if (BothSupportsDefaultPrimaryKey(entityType, repositoryImplementationType))
{
AddDefaultRepositoryForDefaultPrimaryKey(services, entityType, repositoryImplementationType);
}
//if (BothSupportsDefaultPrimaryKey(entityType, repositoryImplementationType))
//{
// AddDefaultRepositoryForDefaultPrimaryKey(services, entityType, repositoryImplementationType);
//}
}
private static void AddDefaultRepositoryForGenericPrimaryKey(IServiceCollection services, Type entityType, Type repositoryImplementationType)
@ -41,29 +41,29 @@ namespace Microsoft.Extensions.DependencyInjection
}
}
private static void AddDefaultRepositoryForDefaultPrimaryKey(IServiceCollection services, Type entityType, Type repositoryImplementationType)
{
//IRepository<TEntity>
var repositoryInterfaceWithDefaultPrimaryKey = typeof(IRepository<>).MakeGenericType(entityType);
if (!repositoryInterfaceWithDefaultPrimaryKey.GetTypeInfo().IsAssignableFrom(repositoryImplementationType))
{
throw new AbpException($"Given repositoryImplementationType ({repositoryImplementationType}) must implement {repositoryInterfaceWithDefaultPrimaryKey}");
}
//private static void AddDefaultRepositoryForDefaultPrimaryKey(IServiceCollection services, Type entityType, Type repositoryImplementationType)
//{
// //IRepository<TEntity>
// var repositoryInterfaceWithDefaultPrimaryKey = typeof(IRepository<>).MakeGenericType(entityType);
// if (!repositoryInterfaceWithDefaultPrimaryKey.GetTypeInfo().IsAssignableFrom(repositoryImplementationType))
// {
// throw new AbpException($"Given repositoryImplementationType ({repositoryImplementationType}) must implement {repositoryInterfaceWithDefaultPrimaryKey}");
// }
services.TryAddTransient(repositoryInterfaceWithDefaultPrimaryKey, repositoryImplementationType);
// services.TryAddTransient(repositoryInterfaceWithDefaultPrimaryKey, repositoryImplementationType);
//IQueryableRepository<TEntity>
var queryableRepositoryInterfaceWithDefaultPrimaryKey = typeof(IQueryableRepository<>).MakeGenericType(entityType);
if (queryableRepositoryInterfaceWithDefaultPrimaryKey.GetTypeInfo().IsAssignableFrom(repositoryImplementationType))
{
services.TryAddTransient(queryableRepositoryInterfaceWithDefaultPrimaryKey, repositoryImplementationType);
}
}
// //IQueryableRepository<TEntity>
// var queryableRepositoryInterfaceWithDefaultPrimaryKey = typeof(IQueryableRepository<>).MakeGenericType(entityType);
// if (queryableRepositoryInterfaceWithDefaultPrimaryKey.GetTypeInfo().IsAssignableFrom(repositoryImplementationType))
// {
// services.TryAddTransient(queryableRepositoryInterfaceWithDefaultPrimaryKey, repositoryImplementationType);
// }
//}
private static bool BothSupportsDefaultPrimaryKey(Type entityType, Type repositoryImplementationType)
{
return typeof(IEntity<Guid>).GetTypeInfo().IsAssignableFrom(entityType) &&
ReflectionHelper.IsAssignableToGenericType(repositoryImplementationType, typeof(IRepository<>));
}
//private static bool BothSupportsDefaultPrimaryKey(Type entityType, Type repositoryImplementationType)
//{
// return typeof(IEntity<Guid>).GetTypeInfo().IsAssignableFrom(entityType) &&
// ReflectionHelper.IsAssignableToGenericType(repositoryImplementationType, typeof(IRepository<>));
//}
}
}

1
src/Volo.Abp.Ddd/Volo/Abp/Application/Services/CrudAppServiceBase.cs

@ -4,7 +4,6 @@ using System.Linq.Dynamic.Core;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
namespace Volo.Abp.Application.Services
{

8
src/Volo.Abp.Ddd/Volo/Abp/Application/Services/IAsyncCrudAppService.cs

@ -1,16 +1,8 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Volo.Abp.Application.Services
{
public interface IAsyncCrudAppService<TEntityDto>
: IAsyncCrudAppService<TEntityDto, Guid>
where TEntityDto : IEntityDto<Guid>
{
}
public interface IAsyncCrudAppService<TEntityDto, in TPrimaryKey>
: IAsyncCrudAppService<TEntityDto, TPrimaryKey, PagedAndSortedResultRequestDto>
where TEntityDto : IEntityDto<TPrimaryKey>

8
src/Volo.Abp.Ddd/Volo/Abp/DependencyInjection/CommonDbContextRegistrationOptions.cs

@ -20,7 +20,7 @@ namespace Volo.Abp.DependencyInjection
public Type DefaultRepositoryImplementationType { get; private set; }
public Type DefaultRepositoryImplementationTypeWithDefaultPrimaryKey { get; private set; }
//public Type DefaultRepositoryImplementationTypeWithDefaultPrimaryKey { get; private set; }
public bool RegisterDefaultRepositories { get; private set; }
@ -28,7 +28,7 @@ namespace Volo.Abp.DependencyInjection
public Dictionary<Type, Type> CustomRepositories { get; }
public bool SpecifiedDefaultRepositoryTypes => DefaultRepositoryImplementationType != null && DefaultRepositoryImplementationTypeWithDefaultPrimaryKey != null;
public bool SpecifiedDefaultRepositoryTypes => DefaultRepositoryImplementationType != null; // && DefaultRepositoryImplementationTypeWithDefaultPrimaryKey != null;
protected CommonDbContextRegistrationOptions(Type originalDbContextType)
{
@ -87,13 +87,11 @@ namespace Volo.Abp.DependencyInjection
return this;
}
public ICommonDbContextRegistrationOptionsBuilder SetDefaultRepositoryClasses([NotNull] Type repositoryImplementationType, [NotNull] Type repositoryImplementationTypeWithDefaultPrimaryKey)
public ICommonDbContextRegistrationOptionsBuilder SetDefaultRepositoryClasses([NotNull] Type repositoryImplementationType)
{
Check.NotNull(repositoryImplementationType, nameof(repositoryImplementationType));
Check.NotNull(repositoryImplementationTypeWithDefaultPrimaryKey, nameof(repositoryImplementationTypeWithDefaultPrimaryKey));
DefaultRepositoryImplementationType = repositoryImplementationType;
DefaultRepositoryImplementationTypeWithDefaultPrimaryKey = repositoryImplementationTypeWithDefaultPrimaryKey;
return this;
}

3
src/Volo.Abp.Ddd/Volo/Abp/DependencyInjection/ICommonDbContextRegistrationOptionsBuilder.cs

@ -47,9 +47,8 @@ namespace Volo.Abp.DependencyInjection
/// Uses given class(es) for default repositories.
/// </summary>
/// <param name="repositoryImplementationType">Repository implementation type</param>
/// <param name="repositoryImplementationTypeWithDefaultPrimaryKey">Repository implementation type for default primary key type (<see cref="string"/>)</param>
/// <returns></returns>
ICommonDbContextRegistrationOptionsBuilder SetDefaultRepositoryClasses(Type repositoryImplementationType, Type repositoryImplementationTypeWithDefaultPrimaryKey);
ICommonDbContextRegistrationOptionsBuilder SetDefaultRepositoryClasses(Type repositoryImplementationType);
/// <summary>
/// Replaces given DbContext type with this DbContext type.

6
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/AggregateRoot.cs

@ -2,10 +2,10 @@
namespace Volo.Abp.Domain.Entities
{
public abstract class AggregateRoot : AggregateRoot<Guid>, IAggregateRoot
{
//public abstract class AggregateRoot : AggregateRoot<Guid>, IAggregateRoot
//{
}
//}
public abstract class AggregateRoot<TPrimaryKey> : Entity<TPrimaryKey>, IAggregateRoot<TPrimaryKey>
{

12
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/Entity.cs

@ -3,13 +3,13 @@ using System.Reflection;
namespace Volo.Abp.Domain.Entities
{
/// <summary>
/// A shortcut of <see cref="Entity{TPrimaryKey}"/> for default primary key type (<see cref="Guid"/>).
/// </summary>
public abstract class Entity : Entity<Guid>, IEntity
{
///// <summary>
///// A shortcut of <see cref="Entity{TPrimaryKey}"/> for default primary key type (<see cref="Guid"/>).
///// </summary>
//public abstract class Entity : Entity<Guid>, IEntity
//{
}
//}
/// <inheritdoc/>
/// <summary>

6
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IAggregateRoot.cs

@ -2,10 +2,10 @@
namespace Volo.Abp.Domain.Entities
{
public interface IAggregateRoot : IAggregateRoot<Guid>, IEntity
{
//public interface IAggregateRoot : IAggregateRoot<Guid>, IEntity
//{
}
//}
public interface IAggregateRoot<TPrimaryKey> : IEntity<TPrimaryKey>
{

12
src/Volo.Abp.Ddd/Volo/Abp/Domain/Entities/IEntity.cs

@ -2,13 +2,13 @@
namespace Volo.Abp.Domain.Entities
{
/// <summary>
/// A shortcut of <see cref="IEntity{TPrimaryKey}"/> for default primary key type (<see cref="string"/>).
/// </summary>
public interface IEntity : IEntity<Guid>
{
///// <summary>
///// A shortcut of <see cref="IEntity{TPrimaryKey}"/> for default primary key type (<see cref="string"/>).
///// </summary>
//public interface IEntity : IEntity<Guid>
//{
}
//}
/// <summary>
/// Defines interface for base entity type. All entities in the system must implement this interface.

8
src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/IQueryableRepository.cs

@ -8,11 +8,11 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories
{
public interface IQueryableRepository<TEntity> : IQueryableRepository<TEntity, Guid>, IRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public interface IQueryableRepository<TEntity> : IQueryableRepository<TEntity, Guid>, IRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public interface IQueryableRepository<TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey>, IQueryable<TEntity>
where TEntity : class, IEntity<TPrimaryKey>

8
src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/IRepository.cs

@ -13,11 +13,11 @@ namespace Volo.Abp.Domain.Repositories
}
public interface IRepository<TEntity> : IRepository<TEntity, Guid>
where TEntity : class, IEntity<Guid>
{
//public interface IRepository<TEntity> : IRepository<TEntity, Guid>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public interface IRepository<TEntity, TPrimaryKey> : IRepository
where TEntity : class, IEntity<TPrimaryKey>

8
src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/QueryableRepositoryBase.cs

@ -11,11 +11,11 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Domain.Repositories
{
public abstract class QueryableRepositoryBase<TEntity> : QueryableRepositoryBase<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public abstract class QueryableRepositoryBase<TEntity> : QueryableRepositoryBase<TEntity, Guid>, IQueryableRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public abstract class QueryableRepositoryBase<TEntity, TPrimaryKey> : RepositoryBase<TEntity, TPrimaryKey>, IQueryableRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>

8
src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/RepositoryBase.cs

@ -8,11 +8,11 @@ using Volo.Abp.Threading;
namespace Volo.Abp.Domain.Repositories
{
public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, Guid>, IRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, Guid>, IRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public abstract class RepositoryBase<TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>

18
src/Volo.Abp.Ddd/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs

@ -46,20 +46,22 @@ namespace Volo.Abp.Domain.Repositories
protected void RegisterDefaultRepository(IServiceCollection services, Type entityType)
{
var primaryKeyType = EntityHelper.GetPrimaryKeyType(entityType);
var isDefaultPrimaryKey = primaryKeyType == typeof(Guid);
//var isDefaultPrimaryKey = primaryKeyType == typeof(Guid);
Type repositoryImplementationType;
if (Options.SpecifiedDefaultRepositoryTypes)
{
repositoryImplementationType = isDefaultPrimaryKey
? Options.DefaultRepositoryImplementationTypeWithDefaultPrimaryKey.MakeGenericType(entityType)
: Options.DefaultRepositoryImplementationType.MakeGenericType(entityType, primaryKeyType);
repositoryImplementationType = Options.DefaultRepositoryImplementationType.MakeGenericType(entityType, primaryKeyType);
//repositoryImplementationType = isDefaultPrimaryKey
// ? Options.DefaultRepositoryImplementationTypeWithDefaultPrimaryKey.MakeGenericType(entityType)
// : Options.DefaultRepositoryImplementationType.MakeGenericType(entityType, primaryKeyType);
}
else
{
repositoryImplementationType = isDefaultPrimaryKey
? GetRepositoryTypeForDefaultPk(Options.DefaultRepositoryDbContextType, entityType)
: GetRepositoryType(Options.DefaultRepositoryDbContextType, entityType, primaryKeyType);
repositoryImplementationType = GetRepositoryType(Options.DefaultRepositoryDbContextType, entityType, primaryKeyType);
//repositoryImplementationType = isDefaultPrimaryKey
// ? GetRepositoryTypeForDefaultPk(Options.DefaultRepositoryDbContextType, entityType)
// : GetRepositoryType(Options.DefaultRepositoryDbContextType, entityType, primaryKeyType);
}
services.AddDefaultRepository(entityType, repositoryImplementationType);
@ -87,7 +89,7 @@ namespace Volo.Abp.Domain.Repositories
protected abstract IEnumerable<Type> GetEntityTypes(Type dbContextType);
protected abstract Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType);
//protected abstract Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType);
protected abstract Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType);
}

18
src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -11,15 +11,15 @@ using Volo.Abp.Threading;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
{
public class EfCoreRepository<TDbContext, TEntity> : EfCoreRepository<TDbContext, TEntity, Guid>, IEfCoreRepository<TEntity>
where TDbContext : IEfCoreDbContext
where TEntity : class, IEntity<Guid>
{
public EfCoreRepository(IDbContextProvider<TDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
}
//public class EfCoreRepository<TDbContext, TEntity> : EfCoreRepository<TDbContext, TEntity, Guid>, IEfCoreRepository<TEntity>
// where TDbContext : IEfCoreDbContext
// where TEntity : class, IEntity<Guid>
//{
// public EfCoreRepository(IDbContextProvider<TDbContext> dbContextProvider)
// : base(dbContextProvider)
// {
// }
//}
public class EfCoreRepository<TDbContext, TEntity, TPrimaryKey> : QueryableRepositoryBase<TEntity, TPrimaryKey>,
IEfCoreRepository<TEntity, TPrimaryKey>,

8
src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/IEfCoreRepository.cs

@ -4,11 +4,11 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
{
public interface IEfCoreRepository<TEntity> : IEfCoreRepository<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public interface IEfCoreRepository<TEntity> : IEfCoreRepository<TEntity, Guid>, IQueryableRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public interface IEfCoreRepository<TEntity, TPrimaryKey> : IQueryableRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>

8
src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/DependencyInjection/EfCoreRepositoryRegistrar.cs

@ -17,10 +17,10 @@ namespace Volo.Abp.EntityFrameworkCore.DependencyInjection
return DbContextHelper.GetEntityTypes(dbContextType);
}
protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
{
return typeof(EfCoreRepository<,>).MakeGenericType(dbContextType, entityType);
}
//protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
//{
// return typeof(EfCoreRepository<,>).MakeGenericType(dbContextType, entityType);
//}
protected override Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType)
{

8
src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/IMemoryDbRepository.cs

@ -4,11 +4,11 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.MemoryDb
{
public interface IMemoryDbRepository<TEntity> : IMemoryDbRepository<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public interface IMemoryDbRepository<TEntity> : IMemoryDbRepository<TEntity, Guid>, IQueryableRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public interface IMemoryDbRepository<TEntity, TPrimaryKey> : IQueryableRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>

18
src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs

@ -6,15 +6,15 @@ using Volo.Abp.MemoryDb;
namespace Volo.Abp.Domain.Repositories.MemoryDb
{
public class MemoryDbRepository<TMemoryDbContext, TEntity> : MemoryDbRepository<TMemoryDbContext, TEntity, Guid>, IMemoryDbRepository<TEntity>
where TMemoryDbContext : MemoryDbContext
where TEntity : class, IEntity<Guid>
{
public MemoryDbRepository(IMemoryDatabaseProvider<TMemoryDbContext> databaseProvider)
: base(databaseProvider)
{
}
}
//public class MemoryDbRepository<TMemoryDbContext, TEntity> : MemoryDbRepository<TMemoryDbContext, TEntity, Guid>, IMemoryDbRepository<TEntity>
// where TMemoryDbContext : MemoryDbContext
// where TEntity : class, IEntity<Guid>
//{
// public MemoryDbRepository(IMemoryDatabaseProvider<TMemoryDbContext> databaseProvider)
// : base(databaseProvider)
// {
// }
//}
public class MemoryDbRepository<TMemoryDbContext, TEntity, TPrimaryKey> : QueryableRepositoryBase<TEntity, TPrimaryKey>, IMemoryDbRepository<TEntity, TPrimaryKey>
where TMemoryDbContext : MemoryDbContext

5
src/Volo.Abp.MemoryDb/Volo/Abp/MemoryDb/DependencyInjection/MemoryDbRepositoryRegistrar.cs

@ -18,11 +18,6 @@ namespace Volo.Abp.MemoryDb.DependencyInjection
return memoryDbContext.GetEntityTypes();
}
protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
{
return typeof(MemoryDbRepository<,>).MakeGenericType(dbContextType, entityType);
}
protected override Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType)
{
return typeof(MemoryDbRepository<,,>).MakeGenericType(dbContextType, entityType, primaryKeyType);

8
src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs

@ -4,11 +4,11 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.MongoDB
{
public interface IMongoDbRepository<TEntity> : IMongoDbRepository<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<Guid>
{
//public interface IMongoDbRepository<TEntity> : IMongoDbRepository<TEntity, Guid>, IQueryableRepository<TEntity>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public interface IMongoDbRepository<TEntity, TPrimaryKey> : IQueryableRepository<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>

18
src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -10,15 +10,15 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.Domain.Repositories.MongoDB
{
public class MongoDbRepository<TMongoDbContext, TEntity> : MongoDbRepository<TMongoDbContext, TEntity, Guid>, IMongoDbRepository<TEntity>
where TMongoDbContext : AbpMongoDbContext
where TEntity : class, IEntity<Guid>
{
public MongoDbRepository(IMongoDatabaseProvider<TMongoDbContext> databaseProvider)
: base(databaseProvider)
{
}
}
//public class MongoDbRepository<TMongoDbContext, TEntity> : MongoDbRepository<TMongoDbContext, TEntity, Guid>, IMongoDbRepository<TEntity>
// where TMongoDbContext : AbpMongoDbContext
// where TEntity : class, IEntity<Guid>
//{
// public MongoDbRepository(IMongoDatabaseProvider<TMongoDbContext> databaseProvider)
// : base(databaseProvider)
// {
// }
//}
public class MongoDbRepository<TMongoDbContext, TEntity, TPrimaryKey> : QueryableRepositoryBase<TEntity, TPrimaryKey>, IMongoDbRepository<TEntity, TPrimaryKey>
where TMongoDbContext : AbpMongoDbContext

5
src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/DependencyInjection/MongoDbRepositoryRegistrar.cs

@ -19,11 +19,6 @@ namespace Volo.Abp.MongoDB.DependencyInjection
return mongoDbContext.GetMappings().Select(m => m.EntityType);
}
protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
{
return typeof(MongoDbRepository<,>).MakeGenericType(dbContextType, entityType);
}
protected override Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType)
{
return typeof(MongoDbRepository<,,>).MakeGenericType(dbContextType, entityType, primaryKeyType);

4
test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs

@ -21,13 +21,13 @@ namespace Volo.Abp.AspNetCore.Mvc
public class PersonAppService_Tests : AspNetCoreMvcTestBase
{
private readonly IQueryableRepository<Person> _personRepository;
private readonly IQueryableRepository<Person, Guid> _personRepository;
private readonly IJsonSerializer _jsonSerializer;
private readonly IObjectMapper _objectMapper;
public PersonAppService_Tests()
{
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person>>();
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person, Guid>>();
_jsonSerializer = ServiceProvider.GetRequiredService<IJsonSerializer>();
_objectMapper = ServiceProvider.GetRequiredService<IObjectMapper>();
}

60
test/Volo.Abp.Ddd.Tests/Volo/Abp/Domain/Repositories/RepositoryRegistration_Tests.cs

@ -25,9 +25,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldNotContainService(typeof(IRepository<MyTestEntityWithCustomPk, int>));
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithGuidPk, Guid>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithGuidPk, Guid>));
services.ShouldNotContainService(typeof(IRepository<MyTestEntityWithInt32Pk, int>));
}
[Fact]
@ -46,9 +46,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithCustomPk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithCustomPk, int>));
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithGuidPk, Guid>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithGuidPk, Guid>));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithInt32Pk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithInt32Pk, int>));
}
[Fact]
@ -61,7 +61,7 @@ namespace Volo.Abp.Domain.Repositories
var options = new TestDbContextRegistrationOptions(typeof(MyFakeDbContext));
options
.AddDefaultRepositories(true)
.AddCustomRepository<MyTestAggregateRootWithDefaultPk, MyTestAggregateRootWithDefaultPkCustomRepository>();
.AddCustomRepository<MyTestAggregateRootWithGuidPk, MyTestAggregateRootWithDefaultPkCustomRepository>();
//Act
@ -69,9 +69,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithCustomPk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithCustomPk, int>));
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithGuidPk, Guid>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithInt32Pk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithInt32Pk, int>));
}
[Fact]
@ -84,7 +84,7 @@ namespace Volo.Abp.Domain.Repositories
var options = new TestDbContextRegistrationOptions(typeof(MyFakeDbContext));
options
.AddDefaultRepositories(true)
.SetDefaultRepositoryClasses(typeof(MyTestCustomBaseRepository<,>), typeof(MyTestCustomBaseRepository<>));
.SetDefaultRepositoryClasses(typeof(MyTestCustomBaseRepository<,>));
//Act
@ -92,9 +92,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithCustomPk, int>), typeof(MyTestCustomBaseRepository<MyTestEntityWithCustomPk, int>));
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithGuidPk, Guid>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithGuidPk, Guid>));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithInt32Pk, int>), typeof(MyTestCustomBaseRepository<MyTestEntityWithInt32Pk, int>));
}
public class MyTestRepositoryRegistrar : RepositoryRegistrarBase<CommonDbContextRegistrationOptions>
@ -108,15 +108,15 @@ namespace Volo.Abp.Domain.Repositories
{
return new[]
{
typeof(MyTestEntityWithCustomPk),
typeof(MyTestAggregateRootWithDefaultPk)
typeof(MyTestEntityWithInt32Pk),
typeof(MyTestAggregateRootWithGuidPk)
};
}
protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
{
return typeof(MyTestDefaultRepository<>).MakeGenericType(entityType);
}
//protected override Type GetRepositoryTypeForDefaultPk(Type dbContextType, Type entityType)
//{
// return typeof(MyTestDefaultRepository<>).MakeGenericType(entityType);
//}
protected override Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType)
{
@ -126,21 +126,21 @@ namespace Volo.Abp.Domain.Repositories
public class MyFakeDbContext { }
public class MyTestAggregateRootWithDefaultPk : AggregateRoot<Guid>
public class MyTestAggregateRootWithGuidPk : AggregateRoot<Guid>
{
}
public class MyTestEntityWithCustomPk : Entity<int>
public class MyTestEntityWithInt32Pk : Entity<int>
{
}
public class MyTestDefaultRepository<TEntity> : MyTestDefaultRepository<TEntity, Guid>
where TEntity : class, IEntity<Guid>
{
//public class MyTestDefaultRepository<TEntity> : MyTestDefaultRepository<TEntity, Guid>
// where TEntity : class, IEntity<Guid>
//{
}
//}
public class MyTestDefaultRepository<TEntity, TPrimaryKey> : RepositoryBase<TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>
@ -176,13 +176,7 @@ namespace Volo.Abp.Domain.Repositories
}
}
public class MyTestAggregateRootWithDefaultPkCustomRepository : MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>
{
}
public class MyTestCustomBaseRepository<TEntity> : MyTestCustomBaseRepository<TEntity, Guid>
where TEntity : class, IEntity<Guid>
public class MyTestAggregateRootWithDefaultPkCustomRepository : MyTestDefaultRepository<MyTestAggregateRootWithGuidPk, Guid>
{
}

4
test/Volo.Abp.Identity.Tests/Volo/Abp/Identity/Initialize_Tests.cs

@ -27,10 +27,10 @@ namespace Volo.Abp.Identity
(ServiceProvider.GetRequiredService<IIdentityUserRepository>() is EfCoreIdentityUserRepository).ShouldBeTrue();
(ServiceProvider.GetRequiredService<IRepository<IdentityUser, Guid>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
(ServiceProvider.GetRequiredService<IRepository<IdentityUser>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
//(ServiceProvider.GetRequiredService<IRepository<IdentityUser>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
(ServiceProvider.GetRequiredService<IQueryableRepository<IdentityUser, Guid>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
(ServiceProvider.GetRequiredService<IQueryableRepository<IdentityUser>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
//(ServiceProvider.GetRequiredService<IQueryableRepository<IdentityUser>>() is EfCoreIdentityUserRepository).ShouldBeTrue();
}
}
}

7
test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/DataFilters/MemoryDb_SoftDelete_DataFilter_Tests.cs

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Data;
@ -10,12 +11,12 @@ namespace Volo.Abp.MemoryDb.DataFilters
{
public class MemoryDb_SoftDelete_DataFilter_Tests : MemoryDbTestBase
{
private readonly IQueryableRepository<Person> _personRepository;
private readonly IQueryableRepository<Person, Guid> _personRepository;
private readonly IDataFilter _dataFilter;
public MemoryDb_SoftDelete_DataFilter_Tests()
{
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person>>();
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person, Guid>>();
_dataFilter = GetRequiredService<IDataFilter>();
}

4
test/Volo.Abp.MemoryDb.Tests/Volo/Abp/MemoryDb/Repositories/MemoryDb_Basic_Repository_Tests.cs

@ -10,11 +10,11 @@ namespace Volo.Abp.MemoryDb.Repositories
{
public class MemoryDb_Basic_Repository_Tests : MemoryDbTestBase
{
private readonly IQueryableRepository<Person> _personRepository;
private readonly IQueryableRepository<Person, Guid> _personRepository;
public MemoryDb_Basic_Repository_Tests()
{
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person>>();
_personRepository = ServiceProvider.GetRequiredService<IQueryableRepository<Person, Guid>>();
}
[Fact]

2
test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs

@ -6,7 +6,7 @@ using Volo.Abp.TestApp.Application.Dto;
namespace Volo.Abp.TestApp.Application
{
public interface IPeopleAppService : IAsyncCrudAppService<PersonDto>
public interface IPeopleAppService : IAsyncCrudAppService<PersonDto, Guid>
{
Task<ListResultDto<PhoneDto>> GetPhones(Guid id, GetPersonPhonesFilter filter);

2
test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.TestApp.Application
{
public class PeopleAppService : AsyncCrudAppService<Person, PersonDto>, IPeopleAppService
{
public PeopleAppService(IQueryableRepository<Person> repository)
public PeopleAppService(IQueryableRepository<Person, Guid> repository)
: base(repository)
{

Loading…
Cancel
Save