Browse Source

Revided Identity DbContext and recreated initial migration.

pull/81/head
Halil İbrahim Kalkan 9 years ago
parent
commit
bdb644b8df
  1. 14
      src/AbpDesk/AbpDesk.Domain/AbpDesk/Tickets/Ticket.cs
  2. 7
      src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs
  3. 35
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs
  4. 38
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161211123930_Ticket_Added_Data_Annotations.Designer.cs
  5. 30
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161211123930_Ticket_Added_Data_Annotations.cs
  6. 24
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123062008_Added_ConcurrencyStamp_To_Ticket.cs
  7. 7
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123122207_AbpDesk_Initial.Designer.cs
  8. 7
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123122207_AbpDesk_Initial.cs
  9. 3
      src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs
  10. 236
      src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170119175536_Initial_Abp_Identity.Designer.cs
  11. 110
      src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123063841_Remove_Unique_Index_Constraints.cs
  12. 76
      src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123121521_Identity_Initial.Designer.cs
  13. 70
      src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123121521_Identity_Initial.cs
  14. 72
      src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/IdentityDbContextModelSnapshot.cs
  15. 48
      src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs
  16. 6
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRole.cs
  17. 8
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRoleClaim.cs
  18. 10
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs
  19. 5
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserClaim.cs
  20. 6
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserLogin.cs
  21. 2
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserRole.cs
  22. 7
      src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserToken.cs

14
src/AbpDesk/AbpDesk.Domain/AbpDesk/Tickets/Ticket.cs

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System;
using JetBrains.Annotations;
using Volo;
using Volo.Abp.Domain.Entities;
@ -11,12 +11,11 @@ namespace AbpDesk.Tickets
public const int MaxBodyLength = 64 * 1024; //64K
[Required]
[MaxLength(MaxTitleLength)]
public string Title { get; set; }
[NotNull]
public string Title { get; protected set; }
[MaxLength(MaxBodyLength)]
public string Body { get; set; }
[CanBeNull]
public string Body { get; protected set; }
public string ConcurrencyStamp { get; set; }
@ -25,12 +24,13 @@ namespace AbpDesk.Tickets
}
public Ticket([NotNull] string title, string body)
public Ticket([NotNull] string title, [CanBeNull] string body = null)
{
Check.NotNull(title, nameof(title));
Title = title;
Body = body;
ConcurrencyStamp = Guid.NewGuid().ToString();
}
}
}

7
src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs

@ -21,9 +21,12 @@ namespace AbpDesk.EntityFrameworkCore
base.OnModelCreating(modelBuilder);
//Use different classes to map each entity type?
modelBuilder.Entity<Ticket>(builder =>
modelBuilder.Entity<Ticket>(b =>
{
builder.ToTable("DskTickets");
b.ToTable("DskTickets");
b.Property(t => t.Title).HasMaxLength(Ticket.MaxTitleLength).IsRequired();
b.Property(t => t.Body).HasMaxLength(Ticket.MaxBodyLength);
});
}
}

35
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs

@ -1,35 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using AbpDesk.EntityFrameworkCore;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
[DbContext(typeof(AbpDeskDbContext))]
[Migration("20161210211733_Initial_Migration")]
partial class Initial_Migration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("AbpDesk.Tickets.Ticket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Body");
b.Property<string>("Title");
b.HasKey("Id");
b.ToTable("DskTickets");
});
}
}
}

38
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161211123930_Ticket_Added_Data_Annotations.Designer.cs

@ -1,38 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using AbpDesk.EntityFrameworkCore;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
[DbContext(typeof(AbpDeskDbContext))]
[Migration("20161211123930_Ticket_Added_Data_Annotations")]
partial class Ticket_Added_Data_Annotations
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("AbpDesk.Tickets.Ticket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Body")
.HasMaxLength(65536);
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("DskTickets");
});
}
}
}

30
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161211123930_Ticket_Added_Data_Annotations.cs

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
public partial class Ticket_Added_Data_Annotations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "DskTickets",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "DskTickets",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256);
}
}
}

24
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123062008_Added_ConcurrencyStamp_To_Ticket.cs

@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
public partial class Added_ConcurrencyStamp_To_Ticket : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ConcurrencyStamp",
table: "DskTickets",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ConcurrencyStamp",
table: "DskTickets");
}
}
}

7
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123062008_Added_ConcurrencyStamp_To_Ticket.Designer.cs → src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123122207_AbpDesk_Initial.Designer.cs

@ -8,8 +8,8 @@ using AbpDesk.EntityFrameworkCore;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
[DbContext(typeof(AbpDeskDbContext))]
[Migration("20170123062008_Added_ConcurrencyStamp_To_Ticket")]
partial class Added_ConcurrencyStamp_To_Ticket
[Migration("20170123122207_AbpDesk_Initial")]
partial class AbpDesk_Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -25,7 +25,8 @@ namespace AbpDesk.EntityFrameworkCore.Migrations
b.Property<string>("Body")
.HasMaxLength(65536);
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Title")
.IsRequired()

7
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.cs → src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20170123122207_AbpDesk_Initial.cs

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata;
namespace AbpDesk.EntityFrameworkCore.Migrations
{
public partial class Initial_Migration : Migration
public partial class AbpDesk_Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -15,8 +15,9 @@ namespace AbpDesk.EntityFrameworkCore.Migrations
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Body = table.Column<string>(nullable: true),
Title = table.Column<string>(nullable: true)
Body = table.Column<string>(maxLength: 65536, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Title = table.Column<string>(maxLength: 256, nullable: false)
},
constraints: table =>
{

3
src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs

@ -24,7 +24,8 @@ namespace AbpDesk.EntityFrameworkCore.Migrations
b.Property<string>("Body")
.HasMaxLength(65536);
b.Property<string>("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Title")
.IsRequired()

236
src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170119175536_Initial_Abp_Identity.Designer.cs

@ -1,236 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Volo.Abp.Identity.EntityFrameworkCore;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{
[DbContext(typeof(IdentityDbContext))]
[Migration("20170119175536_Initial_Abp_Identity")]
partial class Initial_Abp_Identity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("IdentityRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<Guid>("RoleId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("IdentityRoleClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("IdentityUsers");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("IdentityUserClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderKey");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("UserId", "LoginProvider", "ProviderKey")
.IsUnique();
b.ToTable("IdentityUserLogins");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("RoleId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("UserId", "RoleId")
.IsUnique();
b.ToTable("IdentityUserRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<Guid>("UserId");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("UserId", "LoginProvider", "Name")
.IsUnique();
b.ToTable("IdentityUserTokens");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}

110
src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123063841_Remove_Unique_Index_Constraints.cs

@ -1,110 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{
public partial class Remove_Unique_Index_Constraints : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
table: "IdentityUserTokens");
migrationBuilder.DropIndex(
name: "IX_IdentityUserRoles_UserId_RoleId",
table: "IdentityUserRoles");
migrationBuilder.DropIndex(
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
table: "IdentityUserLogins");
migrationBuilder.DropIndex(
name: "UserNameIndex",
table: "IdentityUsers");
migrationBuilder.DropIndex(
name: "RoleNameIndex",
table: "IdentityRoles");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
table: "IdentityUserTokens",
columns: new[] { "UserId", "LoginProvider", "Name" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_UserId_RoleId",
table: "IdentityUserRoles",
columns: new[] { "UserId", "RoleId" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
table: "IdentityUserLogins",
columns: new[] { "UserId", "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "IdentityUsers",
column: "NormalizedUserName");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "IdentityRoles",
column: "NormalizedName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
table: "IdentityUserTokens");
migrationBuilder.DropIndex(
name: "IX_IdentityUserRoles_UserId_RoleId",
table: "IdentityUserRoles");
migrationBuilder.DropIndex(
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
table: "IdentityUserLogins");
migrationBuilder.DropIndex(
name: "UserNameIndex",
table: "IdentityUsers");
migrationBuilder.DropIndex(
name: "RoleNameIndex",
table: "IdentityRoles");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
table: "IdentityUserTokens",
columns: new[] { "UserId", "LoginProvider", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_UserId_RoleId",
table: "IdentityUserRoles",
columns: new[] { "UserId", "RoleId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
table: "IdentityUserLogins",
columns: new[] { "UserId", "LoginProvider", "ProviderKey" },
unique: true);
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "IdentityUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "IdentityRoles",
column: "NormalizedName",
unique: true);
}
}
}

76
src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123063841_Remove_Unique_Index_Constraints.Designer.cs → src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123121521_Identity_Initial.Designer.cs

@ -8,8 +8,8 @@ using Volo.Abp.Identity.EntityFrameworkCore;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{
[DbContext(typeof(IdentityDbContext))]
[Migration("20170123063841_Remove_Unique_Index_Constraints")]
partial class Remove_Unique_Index_Constraints
[Migration("20170123121521_Identity_Initial")]
partial class Identity_Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -33,8 +33,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
b.HasIndex("NormalizedName");
b.ToTable("IdentityRoles");
});
@ -44,9 +43,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
@ -62,7 +64,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
@ -70,9 +74,13 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<bool>("LockoutEnabled");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
@ -86,22 +94,24 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedEmail");
b.HasIndex("NormalizedUserName")
.HasName("UserNameIndex");
b.HasIndex("NormalizedUserName");
b.ToTable("IdentityUsers");
});
@ -111,9 +121,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("UserId");
@ -129,16 +142,23 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderDisplayName")
.HasMaxLength(128);
b.Property<string>("ProviderKey");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("LoginProvider", "ProviderKey");
b.HasIndex("UserId", "LoginProvider", "ProviderKey");
b.ToTable("IdentityUserLogins");
@ -149,13 +169,17 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("IdentityUserId1");
b.Property<Guid>("RoleId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("IdentityUserId1");
b.HasIndex("RoleId", "UserId");
b.HasIndex("UserId", "RoleId");
@ -167,7 +191,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Name");
@ -208,13 +234,17 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.HasForeignKey("IdentityUserId1");
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});

70
src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170119175536_Initial_Abp_Identity.cs → src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/20170123121521_Identity_Initial.cs

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
{
public partial class Initial_Abp_Identity : Migration
public partial class Identity_Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -27,19 +27,19 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0),
ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false),
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false),
UserName = table.Column<string>(maxLength: 256, nullable: true)
},
constraints: table =>
@ -52,8 +52,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
RoleId = table.Column<Guid>(nullable: false)
},
constraints: table =>
@ -72,8 +72,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
@ -92,9 +92,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(nullable: true),
ProviderDisplayName = table.Column<string>(nullable: true),
ProviderKey = table.Column<string>(nullable: true),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true),
ProviderKey = table.Column<string>(maxLength: 256, nullable: false),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
@ -113,12 +113,19 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
IdentityUserId1 = table.Column<Guid>(nullable: true),
RoleId = table.Column<Guid>(nullable: false),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserRoles", x => x.Id);
table.ForeignKey(
name: "FK_IdentityUserRoles_IdentityUsers_IdentityUserId1",
column: x => x.IdentityUserId1,
principalTable: "IdentityUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_IdentityUserRoles_IdentityRoles_RoleId",
column: x => x.RoleId,
@ -138,7 +145,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(nullable: true),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
Name = table.Column<string>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
Value = table.Column<string>(nullable: true)
@ -155,10 +162,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
});
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
name: "IX_IdentityRoles_NormalizedName",
table: "IdentityRoles",
column: "NormalizedName",
unique: true);
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "IX_IdentityRoleClaims_RoleId",
@ -166,43 +172,49 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
name: "IX_IdentityUsers_NormalizedEmail",
table: "IdentityUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
name: "IX_IdentityUsers_NormalizedUserName",
table: "IdentityUsers",
column: "NormalizedUserName",
unique: true);
column: "NormalizedUserName");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserClaims_UserId",
table: "IdentityUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserLogins_LoginProvider_ProviderKey",
table: "IdentityUserLogins",
columns: new[] { "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
table: "IdentityUserLogins",
columns: new[] { "UserId", "LoginProvider", "ProviderKey" },
unique: true);
columns: new[] { "UserId", "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_RoleId",
name: "IX_IdentityUserRoles_IdentityUserId1",
table: "IdentityUserRoles",
column: "RoleId");
column: "IdentityUserId1");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_RoleId_UserId",
table: "IdentityUserRoles",
columns: new[] { "RoleId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_UserId_RoleId",
table: "IdentityUserRoles",
columns: new[] { "UserId", "RoleId" },
unique: true);
columns: new[] { "UserId", "RoleId" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
table: "IdentityUserTokens",
columns: new[] { "UserId", "LoginProvider", "Name" },
unique: true);
columns: new[] { "UserId", "LoginProvider", "Name" });
}
protected override void Down(MigrationBuilder migrationBuilder)

72
src/Volo.Abp.Identity.EntityFrameworkCore/Migrations/IdentityDbContextModelSnapshot.cs

@ -32,8 +32,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
b.HasIndex("NormalizedName");
b.ToTable("IdentityRoles");
});
@ -43,9 +42,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
@ -61,7 +63,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
@ -69,9 +73,13 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<bool>("LockoutEnabled");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
@ -85,22 +93,24 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasDefaultValue(false);
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedEmail");
b.HasIndex("NormalizedUserName")
.HasName("UserNameIndex");
b.HasIndex("NormalizedUserName");
b.ToTable("IdentityUsers");
});
@ -110,9 +120,12 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("UserId");
@ -128,16 +141,23 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderDisplayName")
.HasMaxLength(128);
b.Property<string>("ProviderKey");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("LoginProvider", "ProviderKey");
b.HasIndex("UserId", "LoginProvider", "ProviderKey");
b.ToTable("IdentityUserLogins");
@ -148,13 +168,17 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("IdentityUserId1");
b.Property<Guid>("RoleId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("IdentityUserId1");
b.HasIndex("RoleId", "UserId");
b.HasIndex("UserId", "RoleId");
@ -166,7 +190,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Name");
@ -207,13 +233,17 @@ namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.HasForeignKey("IdentityUserId1");
b.HasOne("Volo.Abp.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Abp.Identity.IdentityUser")
.WithMany("Roles")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});

48
src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs

@ -63,49 +63,62 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
base.OnModelCreating(builder);
//Split configuration to dedicated classes
//TODO: Set Default Values for properties
//TODO: Split configuration to dedicated classes.
builder.Entity<IdentityUser>(b =>
{
b.ToTable("IdentityUsers");
b.Property(u => u.UserName).HasMaxLength(256);
b.Property(u => u.NormalizedUserName).HasMaxLength(256);
b.Property(u => u.Email).HasMaxLength(256);
b.Property(u => u.NormalizedEmail).HasMaxLength(256);
b.Property(u => u.UserName).HasMaxLength(IdentityUser.MaxUserNameLength);
b.Property(u => u.NormalizedUserName).HasMaxLength(IdentityUser.MaxNormalizedUserNameLength);
b.Property(u => u.Email).HasMaxLength(IdentityUser.MaxEmailLength);
b.Property(u => u.NormalizedEmail).HasMaxLength(IdentityUser.MaxNormalizedEmailLength);
b.Property(u => u.EmailConfirmed).HasDefaultValue(false);
b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false);
b.Property(u => u.TwoFactorEnabled).HasDefaultValue(false);
b.Property(u => u.LockoutEnabled).HasDefaultValue(false);
b.Property(u => u.AccessFailedCount).HasDefaultValue(0);
b.HasMany(u => u.Claims).WithOne().HasForeignKey(uc => uc.UserId).IsRequired();
b.HasMany(u => u.Logins).WithOne().HasForeignKey(ul => ul.UserId).IsRequired();
b.HasMany(u => u.Roles).WithOne().HasForeignKey(ur => ur.UserId).IsRequired();
b.HasMany(u => u.Tokens).WithOne().HasForeignKey(ur => ur.UserId).IsRequired();
b.HasIndex(u => u.NormalizedUserName).HasName("UserNameIndex");
b.HasIndex(u => u.NormalizedEmail).HasName("EmailIndex");
b.HasIndex(u => u.NormalizedUserName);
b.HasIndex(u => u.NormalizedEmail);
});
builder.Entity<IdentityRole>(b =>
{
b.ToTable("IdentityRoles");
b.Property(r => r.ConcurrencyStamp).IsConcurrencyToken();
b.Property(u => u.Name).HasMaxLength(256);
b.Property(u => u.NormalizedName).HasMaxLength(256);
b.Property(u => u.Name).HasMaxLength(IdentityRole.MaxNameLength);
b.Property(u => u.NormalizedName).HasMaxLength(IdentityRole.MaxNormalizedNameLength);
//TODO: Relation & Foreign Key!
//b.HasMany(r => r.Users).WithOne().HasForeignKey(ur => ur.RoleId).IsRequired();
b.HasMany(r => r.Claims).WithOne().HasForeignKey(rc => rc.RoleId).IsRequired();
b.HasIndex(r => r.NormalizedName).HasName("RoleNameIndex");
b.HasIndex(r => r.NormalizedName);
});
builder.Entity<IdentityUserClaim>(b =>
{
b.ToTable("IdentityUserClaims");
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityUserClaim.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityUserClaim.MaxClaimValueLength);
b.HasIndex(uc => uc.UserId);
});
builder.Entity<IdentityRoleClaim>(b =>
{
b.ToTable("IdentityRoleClaims");
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityRoleClaim.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityRoleClaim.MaxClaimValueLength);
b.HasIndex(uc => uc.RoleId);
});
builder.Entity<IdentityUserRole>(b =>
@ -113,21 +126,30 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
b.ToTable("IdentityUserRoles");
b.HasOne<IdentityRole>().WithMany().HasForeignKey(ur => ur.RoleId).IsRequired();
b.HasOne<IdentityUser>().WithMany().HasForeignKey(ur => ur.UserId).IsRequired();
b.HasIndex(r => new { r.UserId, r.RoleId });
b.HasIndex(r => new { r.RoleId, r.UserId });
});
builder.Entity<IdentityUserLogin>(b =>
{
b.ToTable("IdentityUserLogins");
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserLogin.MaxLoginProviderLength).IsRequired();
b.Property(ul => ul.ProviderKey).HasMaxLength(IdentityUserLogin.MaxProviderKeyLength).IsRequired();
b.Property(ul => ul.ProviderDisplayName).HasMaxLength(IdentityUserLogin.MaxProviderDisplayNameLength);
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.ProviderKey });
b.HasIndex(l => new { l.LoginProvider, l.ProviderKey });
});
builder.Entity<IdentityUserToken>(b =>
{
b.ToTable("IdentityUserTokens");
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserToken.MaxLoginProviderLength).IsRequired();
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.Name });
});
}

6
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRole.cs

@ -15,6 +15,9 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityRole : AggregateRoot, IHasConcurrencyStamp
{
public const int MaxNameLength = 256;
public const int MaxNormalizedNameLength = MaxNameLength;
/// <summary>
/// Gets or sets the name for this role.
/// </summary>
@ -33,7 +36,7 @@ namespace Volo.Abp.Identity
/// <summary>
/// A random value that should change whenever a role is persisted to the store
/// </summary>
public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
public virtual string ConcurrencyStamp { get; set; }
/// <summary>
/// Initializes a new instance of <see cref="IdentityRole"/>.
@ -51,6 +54,7 @@ namespace Volo.Abp.Identity
Id = id;
Name = name;
ConcurrencyStamp = Guid.NewGuid().ToString();
}
public void AddClaim([NotNull] Claim claim)

8
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRoleClaim.cs

@ -10,6 +10,9 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityRoleClaim : Entity
{
public const int MaxClaimTypeLength = IdentityUserClaim.MaxClaimTypeLength;
public const int MaxClaimValueLength = IdentityUserClaim.MaxClaimValueLength;
/// <summary>
/// Gets or sets the of the primary key of the role associated with this claim.
/// </summary>
@ -27,11 +30,13 @@ namespace Volo.Abp.Identity
protected IdentityRoleClaim()
{
}
public IdentityRoleClaim(Guid roleId, [NotNull] Claim claim)
{
//TODO: Where to set Id?
Check.NotNull(claim, nameof(claim));
RoleId = roleId;
@ -41,7 +46,6 @@ namespace Volo.Abp.Identity
public IdentityRoleClaim(Guid roleId, [NotNull] string claimType, string claimValue)
{
Check.NotNull(roleId, nameof(roleId));
Check.NotNull(claimType, nameof(claimType));
RoleId = roleId;

10
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs

@ -15,6 +15,11 @@ namespace Volo.Abp.Identity
public class IdentityUser : AggregateRoot, IHasConcurrencyStamp
{
public const int MaxUserNameLength = 256;
public const int MaxNormalizedUserNameLength = MaxUserNameLength;
public const int MaxEmailLength = 256;
public const int MaxNormalizedEmailLength = MaxEmailLength;
/// <summary>
/// Gets or sets the user name for this user.
/// </summary>
@ -54,7 +59,7 @@ namespace Volo.Abp.Identity
/// <summary>
/// A random value that must change whenever a user is persisted to the store
/// </summary>
public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
public virtual string ConcurrencyStamp { get; set; }
/// <summary>
/// Gets or sets a telephone number for the user.
@ -125,9 +130,10 @@ namespace Volo.Abp.Identity
Id = id;
UserName = userName;
ConcurrencyStamp = Guid.NewGuid().ToString();
}
public void AddRole([NotNull] Guid roleId)
public void AddRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));

5
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserClaim.cs

@ -10,6 +10,9 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserClaim : Entity
{
public const int MaxClaimTypeLength = 256;
public const int MaxClaimValueLength = 1024;
/// <summary>
/// Gets or sets the primary key of the user associated with this claim.
/// </summary>
@ -32,6 +35,8 @@ namespace Volo.Abp.Identity
public IdentityUserClaim(Guid userId, [NotNull] Claim claim)
{
//TODO: Where to set Id?
Check.NotNull(claim, nameof(claim));
UserId = userId;

6
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserLogin.cs

@ -12,6 +12,10 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserLogin : Entity
{
public const int MaxLoginProviderLength = 64;
public const int MaxProviderKeyLength = 256;
public const int MaxProviderDisplayNameLength = 128;
/// <summary>
/// Gets or sets the of the primary key of the user associated with this login.
/// </summary>
@ -42,6 +46,8 @@ namespace Volo.Abp.Identity
Check.NotNull(loginProvider, nameof(loginProvider));
Check.NotNull(providerKey, nameof(providerKey));
//TODO: Where to set Id?
UserId = userId;
LoginProvider = loginProvider;
ProviderKey = providerKey;

2
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserRole.cs

@ -25,6 +25,8 @@ namespace Volo.Abp.Identity
public IdentityUserRole(Guid userId, Guid roleId)
{
//TODO: Where to set Id?
UserId = userId;
RoleId = roleId;
}

7
src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserToken.cs

@ -9,6 +9,8 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserToken : Entity
{
public const int MaxLoginProviderLength = 64;
/// <summary>
/// Gets or sets the primary key of the user that the token belongs to.
/// </summary>
@ -34,12 +36,13 @@ namespace Volo.Abp.Identity
}
public IdentityUserToken(Guid 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)
{
Check.NotNull(userId, nameof(userId));
Check.NotNull(loginProvider, nameof(loginProvider));
Check.NotNull(name, nameof(name));
//TODO: Where to set Id?
UserId = userId;
LoginProvider = loginProvider;
Name = name;

Loading…
Cancel
Save