Change default PK from string to GUID!

pull/81/head
Halil İbrahim Kalkan 9 years ago
parent ad80d628d3
commit 6f679ab1db

@ -30,7 +30,7 @@ namespace AbpDesk.ConsoleDemo
//blog.Comments.Add(new BlogPostComment("@john", "good post! " + DateTime.Now.ToString(CultureInfo.InvariantCulture), star: (byte)RandomHelper.GetRandom(1, 6))); //blog.Comments.Add(new BlogPostComment("@john", "good post! " + DateTime.Now.ToString(CultureInfo.InvariantCulture), star: (byte)RandomHelper.GetRandom(1, 6)));
//_blogPostRepository.Update(blog); //_blogPostRepository.Update(blog);
//_blogPostRepository.Insert(new BlogPost("Hello World 3!", DateTime.Now.ToString(CultureInfo.InvariantCulture))); //_blogPostRepository.Insert(new BlogPost("Hello World 1!", DateTime.Now.ToString(CultureInfo.InvariantCulture)));
foreach (var blogPost in _blogPostRepository) foreach (var blogPost in _blogPostRepository)
{ {

@ -26,12 +26,6 @@ namespace AbpDesk.ConsoleDemo
Console.WriteLine("Press ENTER to run again..."); Console.WriteLine("Press ENTER to run again...");
Console.ReadLine(); Console.ReadLine();
RunDemo(application);
Console.WriteLine();
Console.WriteLine("Press ENTER to exit...");
Console.ReadLine();
application.Shutdown(); application.Shutdown();
} }
} }

@ -22,7 +22,7 @@ namespace AbpDesk.Blogging
public BlogPost([NotNull] string title, [NotNull] string body) public BlogPost([NotNull] string title, [NotNull] string body)
{ {
Id = Guid.NewGuid().ToString("D"); Id = Guid.NewGuid(); //TODO: Get from ctor!
Check.NotNull(title, nameof(title)); Check.NotNull(title, nameof(title));
Check.NotNull(body, nameof(body)); Check.NotNull(body, nameof(body));

@ -9,9 +9,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
{ {
public class EfCoreRepository<TDbContext, TEntity> : EfCoreRepository<TDbContext, TEntity, string>, IEfCoreRepository<TEntity> public class EfCoreRepository<TDbContext, TEntity> : EfCoreRepository<TDbContext, TEntity, Guid>, IEfCoreRepository<TEntity>
where TDbContext : AbpDbContext<TDbContext> where TDbContext : AbpDbContext<TDbContext>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
public EfCoreRepository(IDbContextProvider<TDbContext> dbContextProvider) public EfCoreRepository(IDbContextProvider<TDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)

@ -1,10 +1,11 @@
using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
{ {
public interface IEfCoreRepository<TEntity> : IEfCoreRepository<TEntity, string>, IQueryableRepository<TEntity> public interface IEfCoreRepository<TEntity> : IEfCoreRepository<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }

@ -8,8 +8,8 @@ using Volo.Abp.Identity.EntityFrameworkCore;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{ {
[DbContext(typeof(IdentityDbContext))] [DbContext(typeof(IdentityDbContext))]
[Migration("20161221194225_AbpIdentity_Initial_Migration")] [Migration("20170119175536_Initial_Abp_Identity")]
partial class AbpIdentity_Initial_Migration partial class Initial_Abp_Identity
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -19,7 +19,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -42,15 +42,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ClaimType"); b.Property<string>("ClaimType");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
b.Property<string>("RoleId") b.Property<Guid>("RoleId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -61,7 +60,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
@ -111,15 +110,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ClaimType"); b.Property<string>("ClaimType");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -130,7 +128,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -139,8 +137,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("ProviderKey"); b.Property<string>("ProviderKey");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -152,14 +149,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("RoleId") b.Property<Guid>("RoleId");
.IsRequired();
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -173,15 +168,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
b.Property<string>("Name"); b.Property<string>("Name");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.Property<string>("Value"); b.Property<string>("Value");

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{ {
public partial class AbpIdentity_Initial_Migration : Migration public partial class Initial_Abp_Identity : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -12,7 +12,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityRoles", name: "IdentityRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true), ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: true), Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true) NormalizedName = table.Column<string>(maxLength: 256, nullable: true)
@ -26,20 +26,20 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityUsers", name: "IdentityUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0), AccessFailedCount = table.Column<int>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true), ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true), Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false), EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false), LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true), NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true), PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true), PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false), PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityStamp = table.Column<string>(nullable: true), SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false), TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true) UserName = table.Column<string>(maxLength: 256, nullable: true)
}, },
constraints: table => constraints: table =>
@ -51,10 +51,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityRoleClaims", name: "IdentityRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false) RoleId = table.Column<Guid>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -71,10 +71,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityUserClaims", name: "IdentityUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<Guid>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -91,11 +91,11 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityUserLogins", name: "IdentityUserLogins",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(nullable: true), LoginProvider = table.Column<string>(nullable: true),
ProviderDisplayName = table.Column<string>(nullable: true), ProviderDisplayName = table.Column<string>(nullable: true),
ProviderKey = table.Column<string>(nullable: true), ProviderKey = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<Guid>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -112,9 +112,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityUserRoles", name: "IdentityUserRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
RoleId = table.Column<string>(nullable: false), RoleId = table.Column<Guid>(nullable: false),
UserId = table.Column<string>(nullable: false) UserId = table.Column<Guid>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -137,10 +137,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
name: "IdentityUserTokens", name: "IdentityUserTokens",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(nullable: true), LoginProvider = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true), Name = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false), UserId = table.Column<Guid>(nullable: false),
Value = table.Column<string>(nullable: true) Value = table.Column<string>(nullable: true)
}, },
constraints: table => constraints: table =>

@ -18,7 +18,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -41,15 +41,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ClaimType"); b.Property<string>("ClaimType");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
b.Property<string>("RoleId") b.Property<Guid>("RoleId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -60,7 +59,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
@ -110,15 +109,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("ClaimType"); b.Property<string>("ClaimType");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -129,7 +127,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -138,8 +136,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("ProviderKey"); b.Property<string>("ProviderKey");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -151,14 +148,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("RoleId") b.Property<Guid>("RoleId");
.IsRequired();
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.HasKey("Id"); b.HasKey("Id");
@ -172,15 +167,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{ {
b.Property<string>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
b.Property<string>("Name"); b.Property<string>("Name");
b.Property<string>("UserId") b.Property<Guid>("UserId");
.IsRequired();
b.Property<string>("Value"); b.Property<string>("Value");

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
@ -22,7 +23,7 @@ namespace Volo.Abp.Identity
return DbSet.FirstOrDefaultAsync(u => u.NormalizedUserName == normalizedUserName, cancellationToken); return DbSet.FirstOrDefaultAsync(u => u.NormalizedUserName == normalizedUserName, cancellationToken);
} }
public Task<List<string>> GetRoleNamesAsync(string userId) public Task<List<string>> GetRoleNamesAsync(Guid userId)
{ {
var query = from userRole in DbContext.UserRoles var query = from userRole in DbContext.UserRoles
join role in DbContext.Roles on userRole.RoleId equals role.Id join role in DbContext.Roles on userRole.RoleId equals role.Id

@ -69,7 +69,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{ {
b.ToTable("IdentityUsers"); b.ToTable("IdentityUsers");
b.Property(u => u.ConcurrencyStamp).IsConcurrencyToken(); b.Property(u => u.ConcurrencyStamp).IsConcurrencyToken(); //TODO: Do automatically?
b.Property(u => u.UserName).HasMaxLength(256); b.Property(u => u.UserName).HasMaxLength(256);
b.Property(u => u.NormalizedUserName).HasMaxLength(256); b.Property(u => u.NormalizedUserName).HasMaxLength(256);
b.Property(u => u.Email).HasMaxLength(256); b.Property(u => u.Email).HasMaxLength(256);

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -11,7 +12,7 @@ namespace Volo.Abp.Identity
{ {
Task<IdentityUser> FindByNormalizedUserNameAsync([NotNull] string normalizedUserName, CancellationToken cancellationToken); Task<IdentityUser> FindByNormalizedUserNameAsync([NotNull] string normalizedUserName, CancellationToken cancellationToken);
Task<List<string>> GetRoleNamesAsync([NotNull] string userId); Task<List<string>> GetRoleNamesAsync(Guid userId);
Task<IdentityUser> FindByLoginAsync([NotNull] string loginProvider, [NotNull] string providerKey, CancellationToken cancellationToken); Task<IdentityUser> FindByLoginAsync([NotNull] string loginProvider, [NotNull] string providerKey, CancellationToken cancellationToken);

@ -1,3 +1,4 @@
using System;
using System.Security.Claims; using System.Security.Claims;
using JetBrains.Annotations; using JetBrains.Annotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -12,7 +13,7 @@ namespace Volo.Abp.Identity
/// <summary> /// <summary>
/// Gets or sets the of the primary key of the role associated with this claim. /// Gets or sets the of the primary key of the role associated with this claim.
/// </summary> /// </summary>
public virtual string RoleId { get; protected set; } public virtual Guid RoleId { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the claim type for this claim. /// Gets or sets the claim type for this claim.
@ -29,9 +30,8 @@ namespace Volo.Abp.Identity
} }
public IdentityRoleClaim([NotNull] string roleId, [NotNull] Claim claim) public IdentityRoleClaim(Guid roleId, [NotNull] Claim claim)
{ {
Check.NotNull(roleId, nameof(roleId));
Check.NotNull(claim, nameof(claim)); Check.NotNull(claim, nameof(claim));
RoleId = roleId; RoleId = roleId;
@ -39,7 +39,7 @@ namespace Volo.Abp.Identity
ClaimValue = claim.Value; ClaimValue = claim.Value;
} }
public IdentityRoleClaim([NotNull] string roleId, [NotNull] string claimType, string claimValue) public IdentityRoleClaim(Guid roleId, [NotNull] string claimType, string claimValue)
{ {
Check.NotNull(roleId, nameof(roleId)); Check.NotNull(roleId, nameof(roleId));
Check.NotNull(claimType, nameof(claimType)); Check.NotNull(claimType, nameof(claimType));

@ -128,7 +128,7 @@ namespace Volo.Abp.Identity
UserName = userName; UserName = userName;
} }
public void AddRole([NotNull] string roleId) public void AddRole([NotNull] Guid roleId)
{ {
Check.NotNull(roleId, nameof(roleId)); Check.NotNull(roleId, nameof(roleId));
@ -140,7 +140,7 @@ namespace Volo.Abp.Identity
Roles.Add(new IdentityUserRole(Id, roleId)); Roles.Add(new IdentityUserRole(Id, roleId));
} }
public void RemoveRole([NotNull] string roleId) public void RemoveRole(Guid roleId)
{ {
Check.NotNull(roleId, nameof(roleId)); Check.NotNull(roleId, nameof(roleId));
@ -152,7 +152,7 @@ namespace Volo.Abp.Identity
Roles.Add(new IdentityUserRole(Id, roleId)); Roles.Add(new IdentityUserRole(Id, roleId));
} }
public bool IsInRole([NotNull] string roleId) public bool IsInRole(Guid roleId)
{ {
Check.NotNull(roleId, nameof(roleId)); Check.NotNull(roleId, nameof(roleId));

@ -1,3 +1,4 @@
using System;
using System.Security.Claims; using System.Security.Claims;
using JetBrains.Annotations; using JetBrains.Annotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -12,7 +13,7 @@ namespace Volo.Abp.Identity
/// <summary> /// <summary>
/// Gets or sets the primary key of the user associated with this claim. /// Gets or sets the primary key of the user associated with this claim.
/// </summary> /// </summary>
public virtual string UserId { get; protected set; } public virtual Guid UserId { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the claim type for this claim. /// Gets or sets the claim type for this claim.
@ -29,9 +30,8 @@ namespace Volo.Abp.Identity
} }
public IdentityUserClaim([NotNull] string userId, [NotNull] Claim claim) public IdentityUserClaim(Guid userId, [NotNull] Claim claim)
{ {
Check.NotNull(userId, nameof(userId));
Check.NotNull(claim, nameof(claim)); Check.NotNull(claim, nameof(claim));
UserId = userId; UserId = userId;
@ -39,9 +39,8 @@ namespace Volo.Abp.Identity
ClaimValue = claim.Value; ClaimValue = claim.Value;
} }
public IdentityUserClaim([NotNull] string userId, [NotNull] string claimType, string claimValue) public IdentityUserClaim(Guid userId, [NotNull] string claimType, string claimValue)
{ {
Check.NotNull(userId, nameof(userId));
Check.NotNull(claimType, nameof(claimType)); Check.NotNull(claimType, nameof(claimType));
UserId = userId; UserId = userId;

@ -1,3 +1,4 @@
using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -14,7 +15,7 @@ namespace Volo.Abp.Identity
/// <summary> /// <summary>
/// Gets or sets the of the primary key of the user associated with this login. /// Gets or sets the of the primary key of the user associated with this login.
/// </summary> /// </summary>
public virtual string UserId { get; protected set; } public virtual Guid UserId { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the login provider for the login (e.g. facebook, google) /// Gets or sets the login provider for the login (e.g. facebook, google)
@ -36,9 +37,8 @@ namespace Volo.Abp.Identity
} }
public IdentityUserLogin([NotNull] string userId, [NotNull] string loginProvider, [NotNull] string providerKey, string providerDisplayName) public IdentityUserLogin(Guid userId, [NotNull] string loginProvider, [NotNull] string providerKey, string providerDisplayName)
{ {
Check.NotNull(userId, nameof(userId));
Check.NotNull(loginProvider, nameof(loginProvider)); Check.NotNull(loginProvider, nameof(loginProvider));
Check.NotNull(providerKey, nameof(providerKey)); Check.NotNull(providerKey, nameof(providerKey));
@ -48,9 +48,8 @@ namespace Volo.Abp.Identity
ProviderDisplayName = providerDisplayName; ProviderDisplayName = providerDisplayName;
} }
public IdentityUserLogin(string userId, UserLoginInfo login) public IdentityUserLogin(Guid userId, UserLoginInfo login)
{ {
Check.NotNull(userId, nameof(userId));
Check.NotNull(login, nameof(login)); Check.NotNull(login, nameof(login));
UserId = userId; UserId = userId;

@ -1,4 +1,4 @@
using JetBrains.Annotations; using System;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Identity namespace Volo.Abp.Identity
@ -11,23 +11,20 @@ namespace Volo.Abp.Identity
/// <summary> /// <summary>
/// Gets or sets the primary key of the user that is linked to a role. /// Gets or sets the primary key of the user that is linked to a role.
/// </summary> /// </summary>
public virtual string UserId { get; protected set; } public virtual Guid UserId { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the primary key of the role that is linked to the user. /// Gets or sets the primary key of the role that is linked to the user.
/// </summary> /// </summary>
public virtual string RoleId { get; protected set; } public virtual Guid RoleId { get; protected set; }
protected IdentityUserRole() protected IdentityUserRole()
{ {
} }
public IdentityUserRole([NotNull] string userId, [NotNull] string roleId) public IdentityUserRole(Guid userId, Guid roleId)
{ {
Check.NotNull(userId, nameof(userId));
Check.NotNull(roleId, nameof(roleId));
UserId = userId; UserId = userId;
RoleId = roleId; RoleId = roleId;
} }

@ -1,3 +1,4 @@
using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -11,7 +12,7 @@ namespace Volo.Abp.Identity
/// <summary> /// <summary>
/// Gets or sets the primary key of the user that the token belongs to. /// Gets or sets the primary key of the user that the token belongs to.
/// </summary> /// </summary>
public virtual string UserId { get; protected set; } public virtual Guid UserId { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the LoginProvider this token is from. /// Gets or sets the LoginProvider this token is from.
@ -33,7 +34,7 @@ namespace Volo.Abp.Identity
} }
public IdentityUserToken([NotNull] string userId, [NotNull] string loginProvider, [NotNull] string name, string value) //TODO: Can value be null? public IdentityUserToken(Guid userId, [NotNull] string loginProvider, [NotNull] string name, string value) //TODO: Can value be null?
{ {
Check.NotNull(userId, nameof(userId)); Check.NotNull(userId, nameof(userId));
Check.NotNull(loginProvider, nameof(loginProvider)); Check.NotNull(loginProvider, nameof(loginProvider));

@ -77,7 +77,7 @@ namespace Volo.Abp.Identity
Check.NotNull(role, nameof(role)); Check.NotNull(role, nameof(role));
await _roleRepository.InsertAsync(role); await _roleRepository.InsertAsync(role, cancellationToken: cancellationToken);
await SaveChanges(cancellationToken); await SaveChanges(cancellationToken);
return IdentityResult.Success; return IdentityResult.Success;
@ -96,7 +96,7 @@ namespace Volo.Abp.Identity
Check.NotNull(role, nameof(role)); Check.NotNull(role, nameof(role));
await _roleRepository.UpdateAsync(role); await _roleRepository.UpdateAsync(role, cancellationToken);
try try
{ {
@ -126,7 +126,7 @@ namespace Volo.Abp.Identity
try try
{ {
await _roleRepository.DeleteAsync(role); await _roleRepository.DeleteAsync(role, cancellationToken);
await SaveChanges(cancellationToken); await SaveChanges(cancellationToken);
} }
catch (AbpDbConcurrencyException ex) catch (AbpDbConcurrencyException ex)
@ -151,7 +151,7 @@ namespace Volo.Abp.Identity
Check.NotNull(role, nameof(role)); Check.NotNull(role, nameof(role));
return Task.FromResult(role.Id); return Task.FromResult(role.Id.ToString());
} }
/// <summary> /// <summary>
@ -194,15 +194,12 @@ namespace Volo.Abp.Identity
/// <param name="id">The role ID to look for.</param> /// <param name="id">The role ID to look for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that result of the look up.</returns> /// <returns>A <see cref="Task{TResult}"/> that result of the look up.</returns>
public virtual Task<IdentityRole> FindByIdAsync([NotNull] string id, CancellationToken cancellationToken = default(CancellationToken)) public virtual Task<IdentityRole> FindByIdAsync(string id, CancellationToken cancellationToken = default(CancellationToken))
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed(); ThrowIfDisposed();
Check.NotNull(id, nameof(id)); return _roleRepository.FindAsync(Guid.Parse(id), cancellationToken);
//TODO: Add cancellationToken to Repository.FindAsync method as overload
return _roleRepository.FindAsync(id);
} }
/// <summary> /// <summary>

@ -87,7 +87,7 @@ namespace Volo.Abp.Identity
Check.NotNull(user, nameof(user)); Check.NotNull(user, nameof(user));
return Task.FromResult(user.Id); return Task.FromResult(user.Id.ToString());
} }
/// <summary> /// <summary>
@ -241,15 +241,12 @@ namespace Volo.Abp.Identity
/// <returns> /// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists. /// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userId"/> if it exists.
/// </returns> /// </returns>
public virtual Task<IdentityUser> FindByIdAsync([NotNull] string userId, CancellationToken cancellationToken = default(CancellationToken)) public virtual Task<IdentityUser> FindByIdAsync(string userId, CancellationToken cancellationToken = default(CancellationToken))
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed(); ThrowIfDisposed();
Check.NotNull(userId, nameof(userId)); return _userRepository.FindAsync(Guid.Parse(userId), cancellationToken);
//TODO: Add cancellationToken to Repository.FindAsync method as overload
return _userRepository.FindAsync(userId);
} }
/// <summary> /// <summary>

@ -1,10 +1,11 @@
using MongoDB.Driver; using System;
using MongoDB.Driver;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.MongoDB namespace Volo.Abp.Domain.Repositories.MongoDB
{ {
public interface IMongoDbRepository<TEntity> : IMongoDbRepository<TEntity, string>, IQueryableRepository<TEntity> public interface IMongoDbRepository<TEntity> : IMongoDbRepository<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }

@ -1,3 +1,4 @@
using System;
using System.Linq; using System.Linq;
using MongoDB.Driver; using MongoDB.Driver;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -5,9 +6,9 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.Domain.Repositories.MongoDB namespace Volo.Abp.Domain.Repositories.MongoDB
{ {
public class MongoDbRepository<TMongoDbContext, TEntity> : MongoDbRepository<TMongoDbContext, TEntity, string>, IMongoDbRepository<TEntity> public class MongoDbRepository<TMongoDbContext, TEntity> : MongoDbRepository<TMongoDbContext, TEntity, Guid>, IMongoDbRepository<TEntity>
where TMongoDbContext : AbpMongoDbContext where TMongoDbContext : AbpMongoDbContext
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
public MongoDbRepository(IMongoDatabaseProvider<TMongoDbContext> databaseProvider) public MongoDbRepository(IMongoDatabaseProvider<TMongoDbContext> databaseProvider)
: base(databaseProvider) : base(databaseProvider)

@ -62,7 +62,7 @@ namespace Microsoft.Extensions.DependencyInjection
private static bool BothSupportsDefaultPrimaryKey(Type entityType, Type repositoryImplementationType) private static bool BothSupportsDefaultPrimaryKey(Type entityType, Type repositoryImplementationType)
{ {
return typeof(IEntity<string>).GetTypeInfo().IsAssignableFrom(entityType) && return typeof(IEntity<Guid>).GetTypeInfo().IsAssignableFrom(entityType) &&
ReflectionHelper.IsAssignableToGenericType(repositoryImplementationType, typeof(IRepository<>)); ReflectionHelper.IsAssignableToGenericType(repositoryImplementationType, typeof(IRepository<>));
} }
} }

@ -1,6 +1,8 @@
namespace Volo.Abp.Domain.Entities using System;
namespace Volo.Abp.Domain.Entities
{ {
public class AggregateRoot : AggregateRoot<string>, IAggregateRoot public class AggregateRoot : AggregateRoot<Guid>, IAggregateRoot
{ {
} }

@ -4,6 +4,7 @@ using Volo.DependencyInjection;
namespace Volo.Abp.Domain.Entities namespace Volo.Abp.Domain.Entities
{ {
//TODO: No need! Directly use Guid Generator!
public class DefaultIdGenerator : IIdGenerator, ITransientDependency public class DefaultIdGenerator : IIdGenerator, ITransientDependency
{ {
private readonly IGuidGenerator _guidGenerator; private readonly IGuidGenerator _guidGenerator;
@ -15,7 +16,7 @@ namespace Volo.Abp.Domain.Entities
public string GenerateStringId() public string GenerateStringId()
{ {
return GenerateGuid().ToString("D"); return GenerateGuid().ToString();
} }
public Guid GenerateGuid() public Guid GenerateGuid()

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

@ -1,6 +1,8 @@
namespace Volo.Abp.Domain.Entities using System;
namespace Volo.Abp.Domain.Entities
{ {
public interface IAggregateRoot : IAggregateRoot<string>, IEntity public interface IAggregateRoot : IAggregateRoot<Guid>, IEntity
{ {
} }

@ -1,9 +1,11 @@
namespace Volo.Abp.Domain.Entities using System;
namespace Volo.Abp.Domain.Entities
{ {
/// <summary> /// <summary>
/// A shortcut of <see cref="IEntity{TPrimaryKey}"/> for default primary key type (<see cref="string"/>). /// A shortcut of <see cref="IEntity{TPrimaryKey}"/> for default primary key type (<see cref="string"/>).
/// </summary> /// </summary>
public interface IEntity : IEntity<string> public interface IEntity : IEntity<Guid>
{ {
} }

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

@ -1,4 +1,5 @@
using System.Threading; using System;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations; using JetBrains.Annotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -11,8 +12,8 @@ namespace Volo.Abp.Domain.Repositories
} }
public interface IRepository<TEntity> : IRepository<TEntity, string> public interface IRepository<TEntity> : IRepository<TEntity, Guid>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }
@ -66,6 +67,7 @@ namespace Volo.Abp.Domain.Repositories
[NotNull] [NotNull]
TEntity Insert([NotNull] TEntity entity, bool autoSave = false); TEntity Insert([NotNull] TEntity entity, bool autoSave = false);
//TODO: Consider to add a new overload that takes cancellationToken as second argument?
/// <summary> /// <summary>
/// Inserts a new entity. /// Inserts a new entity.
/// </summary> /// </summary>
@ -76,7 +78,7 @@ namespace Volo.Abp.Domain.Repositories
/// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <param name="entity">Inserted entity</param> /// <param name="entity">Inserted entity</param>
[NotNull] [NotNull]
Task<TEntity> InsertAsync([NotNull] TEntity entity, bool autoSave = true, CancellationToken cancellationToken = default(CancellationToken)); Task<TEntity> InsertAsync([NotNull] TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default(CancellationToken));
/// <summary> /// <summary>
/// Updates an existing entity. /// Updates an existing entity.

@ -9,8 +9,8 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories namespace Volo.Abp.Domain.Repositories
{ {
public abstract class QueryableRepositoryBase<TEntity> : QueryableRepositoryBase<TEntity, string>, IQueryableRepository<TEntity> public abstract class QueryableRepositoryBase<TEntity> : QueryableRepositoryBase<TEntity, Guid>, IQueryableRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }

@ -6,8 +6,8 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories namespace Volo.Abp.Domain.Repositories
{ {
public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, string>, IRepository<TEntity> public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, Guid>, IRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }

@ -45,7 +45,7 @@ namespace Volo.Abp.Domain.Repositories
protected void RegisterDefaultRepository(IServiceCollection services, Type dbContextType, Type entityType) protected void RegisterDefaultRepository(IServiceCollection services, Type dbContextType, Type entityType)
{ {
var primaryKeyType = EntityHelper.GetPrimaryKeyType(entityType); var primaryKeyType = EntityHelper.GetPrimaryKeyType(entityType);
var isDefaultPrimaryKey = primaryKeyType == typeof(string); var isDefaultPrimaryKey = primaryKeyType == typeof(Guid);
Type repositoryImplementationType; Type repositoryImplementationType;
if (Options.SpecifiedDefaultRepositoryTypes) if (Options.SpecifiedDefaultRepositoryTypes)

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection; using System;
using Microsoft.Extensions.DependencyInjection;
using Shouldly; using Shouldly;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.TestBase; using Volo.Abp.TestBase;
@ -26,10 +27,10 @@ namespace Volo.Abp.Identity
{ {
(ServiceProvider.GetRequiredService<IIdentityUserRepository>() is EfCoreIdentityUserRepository).ShouldBeTrue(); (ServiceProvider.GetRequiredService<IIdentityUserRepository>() is EfCoreIdentityUserRepository).ShouldBeTrue();
(ServiceProvider.GetRequiredService<IRepository<IdentityUser, string>>() 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, string>>() 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();
} }
} }

@ -26,7 +26,7 @@ namespace Volo.Abp.Domain.Repositories
//Assert //Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, string>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldNotContainService(typeof(IRepository<MyTestEntityWithCustomPk, int>)); services.ShouldNotContainService(typeof(IRepository<MyTestEntityWithCustomPk, int>));
} }
@ -47,7 +47,7 @@ namespace Volo.Abp.Domain.Repositories
//Assert //Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestDefaultRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, string>), 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<MyTestEntityWithCustomPk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithCustomPk, int>));
} }
@ -70,7 +70,7 @@ namespace Volo.Abp.Domain.Repositories
//Assert //Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, string>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, Guid>), typeof(MyTestAggregateRootWithDefaultPkCustomRepository));
services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithCustomPk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithCustomPk, int>)); services.ShouldContainTransient(typeof(IRepository<MyTestEntityWithCustomPk, int>), typeof(MyTestDefaultRepository<MyTestEntityWithCustomPk, int>));
} }
@ -93,7 +93,7 @@ namespace Volo.Abp.Domain.Repositories
//Assert //Assert
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>)); services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk>), typeof(MyTestCustomBaseRepository<MyTestAggregateRootWithDefaultPk>));
services.ShouldContainTransient(typeof(IRepository<MyTestAggregateRootWithDefaultPk, string>), 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<MyTestEntityWithCustomPk, int>), typeof(MyTestCustomBaseRepository<MyTestEntityWithCustomPk, int>));
} }
@ -136,8 +136,8 @@ namespace Volo.Abp.Domain.Repositories
} }
public class MyTestDefaultRepository<TEntity> : MyTestDefaultRepository<TEntity, string>, IRepository<TEntity> public class MyTestDefaultRepository<TEntity> : MyTestDefaultRepository<TEntity, Guid>, IRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }
@ -171,8 +171,8 @@ namespace Volo.Abp.Domain.Repositories
} }
public class MyTestCustomBaseRepository<TEntity> : MyTestCustomBaseRepository<TEntity, string>, IRepository<TEntity> public class MyTestCustomBaseRepository<TEntity> : MyTestCustomBaseRepository<TEntity, Guid>, IRepository<TEntity>
where TEntity : class, IEntity<string> where TEntity : class, IEntity<Guid>
{ {
} }

Loading…
Cancel
Save