Skip to content

Commit

Permalink
fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ili committed Jul 6, 2017
1 parent 3b81f4a commit eeb4c84
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/LinqToDB.Identity/IdentityLinqToDbBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public static IdentityBuilder AddLinqToDBStores<TKey>(this IdentityBuilder build

private static IServiceCollection GetDefaultServices(Type keyType, Type userType, Type userClaimType, Type userRoleType, Type userLoginType, Type userTokenType, Type roleType, Type roleClaimType)
{
//UserStore<TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken>
var userStoreType = typeof(UserStore<,,,,,,>).MakeGenericType(userType, roleType, keyType, userClaimType, userRoleType, userLoginType, userTokenType);
// RoleStore<TRole, TKey, TRoleClaim>
var roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, keyType, roleClaimType);
//UserStore<TKey, TUser, TRole, TUserClaim, TUserRole, TUserLogin, TUserToken>
var userStoreType = typeof(UserStore<,,,,,,>).MakeGenericType(keyType, userType, roleType, userClaimType, userRoleType, userLoginType, userTokenType);
// RoleStore<TKey, TRole, TRoleClaim>
var roleStoreType = typeof(RoleStore<,,>).MakeGenericType(keyType, roleType, roleClaimType);

var services = new ServiceCollection();
services.AddScoped(
Expand Down
8 changes: 4 additions & 4 deletions src/LinqToDB.Identity/RoleStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace LinqToDB.Identity
/// Creates a new instance of a persistence store for roles.
/// </summary>
/// <typeparam name="TRole">The type of the class representing a role.</typeparam>
public class RoleStore<TRole> : RoleStore<TRole, string>
public class RoleStore<TRole> : RoleStore<string, TRole>
where TRole : IdentityRole<string>
{
/// <summary>
Expand All @@ -37,8 +37,8 @@ public RoleStore(IConnectionFactory factory, IdentityErrorDescriber describer =
/// </summary>
/// <typeparam name="TRole">The type of the class representing a role.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a role.</typeparam>
public class RoleStore<TRole, TKey> :
RoleStore<TRole, TKey, IdentityRoleClaim<TKey>>
public class RoleStore<TKey, TRole> :
RoleStore<TKey, TRole, IdentityRoleClaim<TKey>>
where TRole : IdentityRole<TKey>
where TKey : IEquatable<TKey>
{
Expand Down Expand Up @@ -74,7 +74,7 @@ protected override IdentityRoleClaim<TKey> CreateRoleClaim(TRole role, Claim cla
/// <typeparam name="TRole">The type of the class representing a role.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a role.</typeparam>
/// <typeparam name="TRoleClaim">The type of the class representing a role claim.</typeparam>
public abstract class RoleStore<TRole, TKey, TRoleClaim> :
public abstract class RoleStore<TKey, TRole, TRoleClaim> :
IQueryableRoleStore<TRole>,
IRoleClaimStore<TRole>
where TRole : class, IIdentityRole<TKey>
Expand Down
10 changes: 5 additions & 5 deletions src/LinqToDB.Identity/UserStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace LinqToDB.Identity
/// Creates a new instance of a persistence store for the specified user type.
/// </summary>
/// <typeparam name="TUser">The type representing a user.</typeparam>
public class UserStore<TUser> : UserStore<TUser, IdentityRole, string>
public class UserStore<TUser> : UserStore<string, TUser, IdentityRole>
where TUser : IdentityUser<string>, new()
{
/// <summary>
Expand All @@ -41,7 +41,7 @@ public UserStore(IConnectionFactory factory, IdentityErrorDescriber describer =
/// </summary>
/// <typeparam name="TUser">The type representing a user.</typeparam>
/// <typeparam name="TRole">The type representing a role.</typeparam>
public class UserStore<TUser, TRole> : UserStore<TUser, TRole, string>
public class UserStore<TUser, TRole> : UserStore<string, TUser, TRole>
where TUser : IdentityUser<string>
where TRole : IdentityRole<string>
{
Expand All @@ -64,8 +64,8 @@ public UserStore(IConnectionFactory factory, IdentityErrorDescriber describer =
/// <typeparam name="TUser">The type representing a user.</typeparam>
/// <typeparam name="TRole">The type representing a role.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a role.</typeparam>
public class UserStore<TUser, TRole, TKey> :
UserStore<TUser, TRole, TKey, IdentityUserClaim<TKey>, IdentityUserRole<TKey>, IdentityUserLogin<TKey>,
public class UserStore<TKey, TUser, TRole> :
UserStore<TKey, TUser, TRole,IdentityUserClaim<TKey>, IdentityUserRole<TKey>, IdentityUserLogin<TKey>,
IdentityUserToken<TKey>>
where TUser : IdentityUser<TKey>
where TRole : IdentityRole<TKey>
Expand Down Expand Up @@ -160,7 +160,7 @@ protected override IdentityUserToken<TKey> CreateUserToken(TUser user, string lo
/// <typeparam name="TUserRole">The type representing a user role.</typeparam>
/// <typeparam name="TUserLogin">The type representing a user external login.</typeparam>
/// <typeparam name="TUserToken">The type representing a user token.</typeparam>
public abstract class UserStore<TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken> :
public abstract class UserStore<TKey, TUser, TRole, TUserClaim, TUserRole, TUserLogin, TUserToken> :
IUserLoginStore<TUser>,
IUserRoleStore<TUser>,
IUserClaimStore<TUser>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ public IdentityUserWithGenerics()
}
}

public class UserStoreWithGenerics : UserStore<IdentityUserWithGenerics, MyIdentityRole,
string, IdentityUserClaimWithIssuer, IdentityUserRoleWithDate, IdentityUserLoginWithContext,
public class UserStoreWithGenerics : UserStore<string, IdentityUserWithGenerics, MyIdentityRole,
IdentityUserClaimWithIssuer, IdentityUserRoleWithDate, IdentityUserLoginWithContext,
IdentityUserTokenWithStuff>
{
public UserStoreWithGenerics(TestConnectionFactory factory, string loginContext)
Expand Down Expand Up @@ -283,7 +283,7 @@ protected override IdentityUserTokenWithStuff CreateUserToken(IdentityUserWithGe
}
}

public class RoleStoreWithGenerics : RoleStore<MyIdentityRole, string, IdentityRoleClaim<string>>
public class RoleStoreWithGenerics : RoleStore<string, MyIdentityRole, IdentityRoleClaim<string>>
{
private string _loginContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ protected override TestConnectionFactory CreateTestContext()
protected override void AddUserStore(IServiceCollection services, TestConnectionFactory context = null)
{
services.AddSingleton<IUserStore<TUser>>(
new UserStore<TUser, TRole, TKey>(CreateTestContext()));
new UserStore<TKey, TUser, TRole>(CreateTestContext()));
}

protected override void AddRoleStore(IServiceCollection services, TestConnectionFactory context = null)
{
services.AddSingleton<IRoleStore<TRole>>(
new RoleStore<TRole, TKey>(CreateTestContext()));
new RoleStore<TKey, TRole>(CreateTestContext()));
}

protected override void SetUserPasswordHash(TUser user, string hashedPassword)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ protected override void AddRoleStore(IServiceCollection services, TestConnection
services.AddSingleton<IRoleStore<GuidRole>>(new ApplicationRoleStore(context ?? CreateTestContext()));
}

public class ApplicationUserStore : UserStore<GuidUser, GuidRole, Guid>
public class ApplicationUserStore : UserStore<Guid, GuidUser, GuidRole>
{
public ApplicationUserStore(IConnectionFactory factory) : base(factory)
{
}
}

public class ApplicationRoleStore : RoleStore<GuidRole, Guid>
public class ApplicationRoleStore : RoleStore<Guid, GuidRole>
{
public ApplicationRoleStore(IConnectionFactory factory) : base(factory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ public IdentityUserWithGenerics()

public class UserStoreWithGenerics :
UserStore<
string,
IdentityUserWithGenerics,
MyIdentityRole,
string,
IdentityUserClaimWithIssuer,
IdentityUserRoleWithDate,
IdentityUserLoginWithContext,
Expand Down Expand Up @@ -296,7 +296,7 @@ protected override IdentityUserTokenWithStuff CreateUserToken(IdentityUserWithGe
}
}

public class RoleStoreWithGenerics : RoleStore<MyIdentityRole, string, IdentityRoleClaimWithIssuer>
public class RoleStoreWithGenerics : RoleStore<string, MyIdentityRole, IdentityRoleClaimWithIssuer>
{
private string _loginContext;

Expand Down

0 comments on commit eeb4c84

Please sign in to comment.