@ -25,9 +25,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefaultPk > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithDefaultPk > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefault Pk , Guid > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithDefaultPk > ) ) ;
services . ShouldNotContainService ( typeof ( IRepository < MyTestEntityWithCustom Pk , int > ) ) ;
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithGuid Pk , Guid > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithGuidPk , Guid > ) ) ;
services . ShouldNotContainService ( typeof ( IRepository < MyTestEntityWithInt32 Pk , int > ) ) ;
}
[Fact]
@ -46,9 +46,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefaultPk > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithDefaultPk > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefault Pk , Guid > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithDefaultPk > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithCustom Pk , int > ) , typeof ( MyTestDefaultRepository < MyTestEntityWithCustom Pk , int > ) ) ;
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithGuid Pk , Guid > ) , typeof ( MyTestDefaultRepository < MyTestAggregateRootWithGuidPk , Guid > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithInt32 Pk , int > ) , typeof ( MyTestDefaultRepository < MyTestEntityWithInt32 Pk , int > ) ) ;
}
[Fact]
@ -61,7 +61,7 @@ namespace Volo.Abp.Domain.Repositories
var options = new TestDbContextRegistrationOptions ( typeof ( MyFakeDbContext ) ) ;
options
. AddDefaultRepositories ( true )
. AddCustomRepository < MyTestAggregateRootWithDefault Pk , MyTestAggregateRootWithDefaultPkCustomRepository > ( ) ;
. AddCustomRepository < MyTestAggregateRootWithGuid Pk , MyTestAggregateRootWithDefaultPkCustomRepository > ( ) ;
//Act
@ -69,9 +69,9 @@ namespace Volo.Abp.Domain.Repositories
//Assert
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefaultPk > ) , typeof ( MyTestAggregateRootWithDefaultPkCustomRepository ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithDefault Pk , Guid > ) , typeof ( MyTestAggregateRootWithDefaultPkCustomRepository ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithCustom Pk , int > ) , typeof ( MyTestDefaultRepository < MyTestEntityWithCustom Pk , int > ) ) ;
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithGuid Pk , Guid > ) , typeof ( MyTestAggregateRootWithDefaultPkCustomRepository ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithInt32 Pk , int > ) , typeof ( MyTestDefaultRepository < MyTestEntityWithInt32 Pk , 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 < MyTestAggregateRootWithDefault Pk , Guid > ) , typeof ( MyTestCustomBaseRepository < MyTestAggregateRootWithDefaultPk > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithCustom Pk , int > ) , typeof ( MyTestCustomBaseRepository < MyTestEntityWithCustom Pk , int > ) ) ;
//services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>));
services . ShouldContainTransient ( typeof ( IRepository < MyTestAggregateRootWithGuid Pk , Guid > ) , typeof ( MyTestCustomBaseRepository < MyTestAggregateRootWithGuidPk , Guid > ) ) ;
services . ShouldContainTransient ( typeof ( IRepository < MyTestEntityWithInt32 Pk , int > ) , typeof ( MyTestCustomBaseRepository < MyTestEntityWithInt32 Pk , int > ) ) ;
}
public class MyTestRepositoryRegistrar : RepositoryRegistrarBase < CommonDbContextRegistrationOptions >
@ -108,15 +108,15 @@ namespace Volo.Abp.Domain.Repositories
{
return new [ ]
{
typeof ( MyTestEntityWithCustom Pk ) ,
typeof ( MyTestAggregateRootWithDefault Pk )
typeof ( MyTestEntityWithInt32 Pk ) ,
typeof ( MyTestAggregateRootWithGuid Pk )
} ;
}
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 MyTestAggregateRootWithDefault Pk : AggregateRoot < Guid >
public class MyTestAggregateRootWithGuid Pk : AggregateRoot < Guid >
{
}
public class MyTestEntityWithCustom Pk : Entity < int >
public class MyTestEntityWithInt32 Pk : 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 >
{
}