diff --git a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj index 0a0bac1ff4..7f8acd52f5 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj +++ b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj @@ -7,7 +7,7 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.Application/BookAppService.cs b/samples/BookStore/src/Acme.BookStore.Application/BookAppService.cs index 1d5e844f30..9534ab7f12 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/BookAppService.cs +++ b/samples/BookStore/src/Acme.BookStore.Application/BookAppService.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; @@ -15,5 +16,19 @@ namespace Acme.BookStore { } + + public override async Task UpdateAsync(Guid id, CreateUpdateBookDto input) + { + await CheckUpdatePolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + + //TODO: Check if input has id different than given id and normalize if it's default value, throw ex otherwise + + MapToEntity(input, entity); + await CurrentUnitOfWork.SaveChangesAsync(); + + return MapToEntityDto(entity); + } } } \ No newline at end of file diff --git a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj index cc4a6a3931..87a8e297b3 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj +++ b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj @@ -6,7 +6,7 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj index 2fd61caefe..44fb8928f6 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj @@ -5,6 +5,11 @@ Acme.BookStore + + + + + @@ -12,10 +17,10 @@ - - - - + + + + diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.Designer.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.Designer.cs similarity index 88% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.Designer.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.Designer.cs index 417f22f978..c9ae3e5b0a 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.Designer.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.Designer.cs @@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Acme.BookStore.Migrations { [DbContext(typeof(BookStoreDbContext))] - [Migration("20180703184727_Created_Book_Entity")] - partial class Created_Book_Entity + [Migration("20181204060805_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -21,32 +21,33 @@ namespace Acme.BookStore.Migrations .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Acme.BookStore.Book", b => + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("CreationTime"); - - b.Property("CreatorId"); - - b.Property("LastModificationTime"); + b.Property("Description") + .HasMaxLength(256); - b.Property("LastModifierId"); + b.Property("IsStatic"); b.Property("Name") .IsRequired() - .HasMaxLength(128); + .HasMaxLength(256); - b.Property("Price"); + b.Property("Regex") + .HasMaxLength(512); - b.Property("PublishDate"); + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); - b.Property("Type"); + b.Property("ValueType"); b.HasKey("Id"); - b.ToTable("Books"); + b.ToTable("AbpClaimTypes"); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => @@ -56,6 +57,15 @@ namespace Acme.BookStore.Migrations b.Property("ConcurrencyStamp"); + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + b.Property("Name") .IsRequired() .HasMaxLength(256); @@ -111,6 +121,14 @@ namespace Acme.BookStore.Migrations .HasColumnName("ConcurrencyStamp") .HasMaxLength(256); + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("DeleterId"); + + b.Property("DeletionTime"); + b.Property("Email") .HasColumnName("Email") .HasMaxLength(256); @@ -123,6 +141,12 @@ namespace Acme.BookStore.Migrations b.Property("ExtraProperties") .HasColumnName("ExtraProperties"); + b.Property("IsDeleted"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") @@ -130,6 +154,10 @@ namespace Acme.BookStore.Migrations b.Property("LockoutEnd"); + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") .HasMaxLength(256); @@ -157,6 +185,10 @@ namespace Acme.BookStore.Migrations .HasColumnName("SecurityStamp") .HasMaxLength(256); + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + b.Property("TenantId") .HasColumnName("TenantId"); @@ -249,9 +281,10 @@ namespace Acme.BookStore.Migrations b.Property("UserId"); b.Property("LoginProvider") - .HasMaxLength(128); + .HasMaxLength(64); - b.Property("Name"); + b.Property("Name") + .HasMaxLength(128); b.Property("TenantId"); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.cs similarity index 85% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.cs index 7722e7bd64..237dc43192 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060805_Initial.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; namespace Acme.BookStore.Migrations @@ -8,6 +7,24 @@ namespace Acme.BookStore.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 256, nullable: false), + Required = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + Regex = table.Column(maxLength: 512, nullable: true), + RegexDescription = table.Column(maxLength: 128, nullable: true), + Description = table.Column(maxLength: 256, nullable: true), + ValueType = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpPermissionGrants", columns: table => new @@ -31,7 +48,10 @@ namespace Acme.BookStore.Migrations TenantId = table.Column(nullable: true), Name = table.Column(maxLength: 256, nullable: false), NormalizedName = table.Column(maxLength: 256, nullable: false), - ConcurrencyStamp = table.Column(nullable: true) + ConcurrencyStamp = table.Column(nullable: true), + IsDefault = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + IsPublic = table.Column(nullable: false) }, constraints: table => { @@ -58,9 +78,18 @@ namespace Acme.BookStore.Migrations columns: table => new { Id = table.Column(nullable: false), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), TenantId = table.Column(nullable: true), UserName = table.Column(maxLength: 256, nullable: false), NormalizedUserName = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 64, nullable: true), + Surname = table.Column(maxLength: 64, nullable: true), Email = table.Column(maxLength: 256, nullable: true), NormalizedEmail = table.Column(maxLength: 256, nullable: true), EmailConfirmed = table.Column(nullable: false, defaultValue: false), @@ -174,8 +203,8 @@ namespace Acme.BookStore.Migrations { TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), Value = table.Column(nullable: true) }, constraints: table => @@ -247,6 +276,9 @@ namespace Acme.BookStore.Migrations protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + migrationBuilder.DropTable( name: "AbpPermissionGrants"); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.Designer.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060902_Created_Book_Entity.Designer.cs similarity index 78% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.Designer.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060902_Created_Book_Entity.Designer.cs index 89843d2d16..5e6cc3ac1e 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.Designer.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060902_Created_Book_Entity.Designer.cs @@ -1,27 +1,83 @@ // using System; -using System.Collections.Generic; +using Acme.BookStore.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Acme.BookStore.EntityFrameworkCore; namespace Acme.BookStore.Migrations { [DbContext(typeof(BookStoreDbContext))] - [Migration("20180528221424_Initial")] - partial class Initial + [Migration("20181204060902_Created_Book_Entity")] + partial class Created_Book_Entity { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.0-preview2-30571") + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Acme.BookStore.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("Price"); + + b.Property("PublishDate"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("Books"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Regex") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); + + b.Property("ValueType"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") @@ -29,6 +85,15 @@ namespace Acme.BookStore.Migrations b.Property("ConcurrencyStamp"); + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + b.Property("Name") .IsRequired() .HasMaxLength(256); @@ -84,6 +149,14 @@ namespace Acme.BookStore.Migrations .HasColumnName("ConcurrencyStamp") .HasMaxLength(256); + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("DeleterId"); + + b.Property("DeletionTime"); + b.Property("Email") .HasColumnName("Email") .HasMaxLength(256); @@ -96,6 +169,12 @@ namespace Acme.BookStore.Migrations b.Property("ExtraProperties") .HasColumnName("ExtraProperties"); + b.Property("IsDeleted"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") @@ -103,6 +182,10 @@ namespace Acme.BookStore.Migrations b.Property("LockoutEnd"); + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") .HasMaxLength(256); @@ -130,6 +213,10 @@ namespace Acme.BookStore.Migrations .HasColumnName("SecurityStamp") .HasMaxLength(256); + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + b.Property("TenantId") .HasColumnName("TenantId"); @@ -222,9 +309,10 @@ namespace Acme.BookStore.Migrations b.Property("UserId"); b.Property("LoginProvider") - .HasMaxLength(128); + .HasMaxLength(64); - b.Property("Name"); + b.Property("Name") + .HasMaxLength(128); b.Property("TenantId"); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060902_Created_Book_Entity.cs similarity index 100% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20181204060902_Created_Book_Entity.cs diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/BookStoreDbContextModelSnapshot.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/BookStoreDbContextModelSnapshot.cs index 122a306295..e3bd17d745 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/BookStoreDbContextModelSnapshot.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/BookStoreDbContextModelSnapshot.cs @@ -47,6 +47,35 @@ namespace Acme.BookStore.Migrations b.ToTable("Books"); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Regex") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); + + b.Property("ValueType"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") @@ -54,6 +83,15 @@ namespace Acme.BookStore.Migrations b.Property("ConcurrencyStamp"); + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + b.Property("Name") .IsRequired() .HasMaxLength(256); @@ -109,6 +147,14 @@ namespace Acme.BookStore.Migrations .HasColumnName("ConcurrencyStamp") .HasMaxLength(256); + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("DeleterId"); + + b.Property("DeletionTime"); + b.Property("Email") .HasColumnName("Email") .HasMaxLength(256); @@ -121,6 +167,12 @@ namespace Acme.BookStore.Migrations b.Property("ExtraProperties") .HasColumnName("ExtraProperties"); + b.Property("IsDeleted"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") @@ -128,6 +180,10 @@ namespace Acme.BookStore.Migrations b.Property("LockoutEnd"); + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") .HasMaxLength(256); @@ -155,6 +211,10 @@ namespace Acme.BookStore.Migrations .HasColumnName("SecurityStamp") .HasMaxLength(256); + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + b.Property("TenantId") .HasColumnName("TenantId"); @@ -247,9 +307,10 @@ namespace Acme.BookStore.Migrations b.Property("UserId"); b.Property("LoginProvider") - .HasMaxLength(128); + .HasMaxLength(64); - b.Property("Name"); + b.Property("Name") + .HasMaxLength(128); b.Property("TenantId"); diff --git a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj index 148c445622..5cfa52f2c8 100644 --- a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj +++ b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj @@ -27,10 +27,10 @@ - - - - + + + + diff --git a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj index 7a1b5d1ae9..fe3b577dc5 100644 --- a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj index d5b5e468b4..c10970a304 100644 --- a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj @@ -15,7 +15,7 @@ - +