Browse Source

Update BookStore sample porject based on the latest startup template

pull/1008/head
杨涛 7 years ago
parent
commit
64f3b641b2
  1. 1
      samples/BookStore/.gitattributes
  2. 255
      samples/BookStore/.gitignore
  3. 7
      samples/BookStore/Acme.BookStore.sln.DotSettings
  4. 2
      samples/BookStore/common.props
  5. 6
      samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
  6. 10
      samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs
  7. 12
      samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
  8. 2
      samples/BookStore/src/Acme.BookStore.Domain/Book.cs
  9. 2
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreConsts.cs
  10. 12
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs
  11. 2
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/BookStoreResource.cs
  12. 34
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/zh-Hans.json
  13. 4
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj
  14. 3
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs
  15. 122
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs
  16. 54
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs
  17. 116
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.Designer.cs
  18. 0
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.cs
  19. 91
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs
  20. 14
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
  21. 12
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs
  22. 6
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs
  23. 14
      samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
  24. 31
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs
  25. 9
      samples/BookStore/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs
  26. 2404
      samples/BookStore/src/Acme.BookStore.Web/package-lock.json
  27. 4
      samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
  28. 1
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookAppService_Tests.cs
  29. 12
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreTestDataBuilder.cs
  30. 2
      samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj

1
samples/BookStore/.gitattributes

@ -0,0 +1 @@
**/wwwroot/libs/** linguist-vendored

255
samples/BookStore/.gitignore

@ -0,0 +1,255 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# BookStore
src/Acme.BookStore.Web/Logs/logs.txt

7
samples/BookStore/Acme.BookStore.sln.DotSettings

@ -0,0 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/AbsolutePath/@EntryValue">D:\github\abp\common.DotSettings</s:String>
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/RelativePath/@EntryValue">..\..\..\common.DotSettings</s:String>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean>
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/RelativePriority/@EntryValue">1</s:Double>
</wpf:ResourceDictionary>

2
samples/BookStore/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.15.0</Version>
<Version>0.16.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
</Project>

6
samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj

@ -9,8 +9,10 @@
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="0.15.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="0.16.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.16.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="0.16.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="0.16.0" />
</ItemGroup>
</Project>

10
samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs

@ -1,16 +1,18 @@
using Acme.BookStore.Permissions;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.AutoMapper;
using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement;
namespace Acme.BookStore
{
[DependsOn(
typeof(BookStoreDomainModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementApplicationModule)
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpFeatureManagementApplicationModule)
)]
public class BookStoreApplicationModule : AbpModule
{

12
samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj

@ -8,11 +8,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Identity.Domain" Version="0.15.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.15.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.15.0" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Auditing" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Identity.Domain" Version="0.16.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.16.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.16.0" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.16.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="0.16.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Auditing" Version="0.16.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
</ItemGroup>

2
samples/BookStore/src/Acme.BookStore.Domain/Book.cs

@ -5,7 +5,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Acme.BookStore
{
[Table(BookStoreConsts.DbTablePrefix+"Books")]
[Table("Books")]
public class Book : AuditedAggregateRoot<Guid>
{
[Required]

2
samples/BookStore/src/Acme.BookStore.Domain/BookStoreConsts.cs

@ -5,5 +5,7 @@
public const string DbTablePrefix = "App";
public const string DbSchema = null;
public const bool IsMultiTenancyEnabled = true;
}
}

12
samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs

@ -2,11 +2,14 @@
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.TenantManagement;
using Volo.Abp.VirtualFileSystem;
namespace Acme.BookStore
@ -16,7 +19,9 @@ namespace Acme.BookStore
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpAuditingModule),
typeof(BackgroundJobsDomainModule),
typeof(AbpAuditLoggingDomainModule)
typeof(AbpAuditLoggingDomainModule),
typeof(AbpTenantManagementDomainModule),
typeof(AbpFeatureManagementDomainModule)
)]
public class BookStoreDomainModule : AbpModule
{
@ -34,6 +39,11 @@ namespace Acme.BookStore
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BookStore");
});
Configure<MultiTenancyOptions>(options =>
{
options.IsEnabled = BookStoreConsts.IsMultiTenancyEnabled;
});
}
}
}

2
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/BookStoreResource.cs

@ -7,4 +7,4 @@ namespace Acme.BookStore.Localization.BookStore
{
}
}
}

34
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/zh-Hans.json

@ -1,20 +1,20 @@
{
"culture": "zh-Hans",
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io.",
"Menu:BookStore": "图书商店",
"Menu:Books": "图书",
"Name": "名称",
"Type": "类型",
"PublishDate": "出版时间",
"Price": "价格",
"CreationTime": "添加时间",
"NewBook": "新书籍",
"Books": "图书",
"Update": "更新",
"BookDeletionConfirmationMessage": "你确定删除书箱: {0} 吗",
"SuccessfullyDeleted": "删除成功."
}
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io.",
"Menu:BookStore": "图书商店",
"Menu:Books": "图书",
"Name": "名称",
"Type": "类型",
"PublishDate": "出版时间",
"Price": "价格",
"CreationTime": "添加时间",
"NewBook": "新书籍",
"Books": "图书",
"Update": "更新",
"BookDeletionConfirmationMessage": "你确定删除书箱: {0} 吗",
"SuccessfullyDeleted": "删除成功."
}
}

4
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj

@ -7,6 +7,10 @@
<RootNamespace>Acme.BookStore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20190320072839_Initial.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
</ItemGroup>

3
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs

@ -6,12 +6,12 @@ using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace Acme.BookStore.EntityFrameworkCore
{
public class BookStoreMigrationsDbContext : AbpDbContext<BookStoreMigrationsDbContext>
{
public DbSet<Book> Book { get; set; }
public BookStoreMigrationsDbContext(DbContextOptions<BookStoreMigrationsDbContext> options)
: base(options)
{
@ -29,6 +29,7 @@ namespace Acme.BookStore.EntityFrameworkCore
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureTenantManagement();
/* Configure customizations for entities from the modules included */

122
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190328093603_Created_Book_Entity.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs

@ -1,65 +1,26 @@
// <auto-generated />
using System;
using Acme.BookStore.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Acme.BookStore.EntityFrameworkCore;
namespace Acme.BookStore.Migrations
{
[DbContext(typeof(BookStoreMigrationsDbContext))]
[Migration("20190328093603_Created_Book_Entity")]
partial class Created_Book_Entity
[Migration("20190402131334_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Acme.BookStore.Book", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<float>("Price");
b.Property<DateTime>("PublishDate");
b.Property<byte>("Type");
b.HasKey("Id");
b.ToTable("AppBooks");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
@ -123,6 +84,8 @@ namespace Acme.BookStore.Migrations
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("TenantName");
b.Property<string>("Url")
.HasColumnName("Url")
.HasMaxLength(256);
@ -202,6 +165,8 @@ namespace Acme.BookStore.Migrations
.HasColumnName("EntityId")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
@ -650,6 +615,69 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.Property<Guid>("TenantId");
b.Property<string>("Name")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024);
b.HasKey("TenantId", "Name");
b.ToTable("AbpTenantConnectionStrings");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog")
@ -718,6 +746,14 @@ namespace Acme.BookStore.Migrations
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")
.WithMany("ConnectionStrings")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}

54
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs

@ -18,6 +18,7 @@ namespace Acme.BookStore.Migrations
UserId = table.Column<Guid>(nullable: true),
UserName = table.Column<string>(maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(nullable: true),
TenantName = table.Column<string>(nullable: true),
ImpersonatorUserId = table.Column<Guid>(nullable: true),
ImpersonatorTenantId = table.Column<Guid>(nullable: true),
ExecutionTime = table.Column<DateTime>(nullable: false),
@ -128,6 +129,27 @@ namespace Acme.BookStore.Migrations
table.PrimaryKey("PK_AbpSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpTenants",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
Name = table.Column<string>(maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpTenants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUsers",
columns: table => new
@ -198,6 +220,7 @@ namespace Acme.BookStore.Migrations
TenantId = table.Column<Guid>(nullable: true),
ChangeTime = table.Column<DateTime>(nullable: false),
ChangeType = table.Column<byte>(nullable: false),
EntityTenantId = table.Column<Guid>(nullable: true),
EntityId = table.Column<string>(maxLength: 128, nullable: false),
EntityTypeFullName = table.Column<string>(maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(nullable: true)
@ -234,6 +257,25 @@ namespace Acme.BookStore.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpTenantConnectionStrings",
columns: table => new
{
TenantId = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 64, nullable: false),
Value = table.Column<string>(maxLength: 1024, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name });
table.ForeignKey(
name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId",
column: x => x.TenantId,
principalTable: "AbpTenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserClaims",
columns: table => new
@ -405,6 +447,12 @@ namespace Acme.BookStore.Migrations
table: "AbpSettings",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpTenants_Name",
table: "AbpTenants",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpUserClaims_UserId",
table: "AbpUserClaims",
@ -464,6 +512,9 @@ namespace Acme.BookStore.Migrations
migrationBuilder.DropTable(
name: "AbpSettings");
migrationBuilder.DropTable(
name: "AbpTenantConnectionStrings");
migrationBuilder.DropTable(
name: "AbpUserClaims");
@ -479,6 +530,9 @@ namespace Acme.BookStore.Migrations
migrationBuilder.DropTable(
name: "AbpEntityChanges");
migrationBuilder.DropTable(
name: "AbpTenants");
migrationBuilder.DropTable(
name: "AbpRoles");

116
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.Designer.cs

@ -1,26 +1,59 @@
// <auto-generated />
using System;
using Acme.BookStore.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Acme.BookStore.EntityFrameworkCore;
namespace Acme.BookStore.Migrations
{
[DbContext(typeof(BookStoreMigrationsDbContext))]
[Migration("20190320072839_Initial")]
partial class Initial
[Migration("20190416070050_Created_Book_Entity")]
partial class Created_Book_Entity
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Acme.BookStore.Book", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<float>("Price");
b.Property<DateTime>("PublishDate");
b.Property<byte>("Type");
b.HasKey("Id");
b.ToTable("AppBooks");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
@ -84,6 +117,8 @@ namespace Acme.BookStore.Migrations
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("TenantName");
b.Property<string>("Url")
.HasColumnName("Url")
.HasMaxLength(256);
@ -163,6 +198,8 @@ namespace Acme.BookStore.Migrations
.HasColumnName("EntityId")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
@ -611,6 +648,69 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.Property<Guid>("TenantId");
b.Property<string>("Name")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024);
b.HasKey("TenantId", "Name");
b.ToTable("AbpTenantConnectionStrings");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog")
@ -679,6 +779,14 @@ namespace Acme.BookStore.Migrations
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")
.WithMany("ConnectionStrings")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}

0
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190328093603_Created_Book_Entity.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190416070050_Created_Book_Entity.cs

91
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs

@ -24,24 +24,18 @@ namespace Acme.BookStore.Migrations
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<Guid?>("LastModifierId");
b.Property<string>("Name")
.IsRequired()
@ -121,6 +115,8 @@ namespace Acme.BookStore.Migrations
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("TenantName");
b.Property<string>("Url")
.HasColumnName("Url")
.HasMaxLength(256);
@ -200,6 +196,8 @@ namespace Acme.BookStore.Migrations
.HasColumnName("EntityId")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
@ -648,6 +646,69 @@ namespace Acme.BookStore.Migrations
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.Property<Guid>("TenantId");
b.Property<string>("Name")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024);
b.HasKey("TenantId", "Name");
b.ToTable("AbpTenantConnectionStrings");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog")
@ -716,6 +777,14 @@ namespace Acme.BookStore.Migrations
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant")
.WithMany("ConnectionStrings")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}

14
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj

@ -9,12 +9,14 @@
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.15.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.15.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.15.0" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.15.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.15.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="0.16.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.16.0" />
</ItemGroup>
</Project>

12
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContextModelCreatingExtensions.cs

@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Volo.Abp;
using Volo.Abp.Users;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace Acme.BookStore.EntityFrameworkCore
{
@ -13,12 +14,11 @@ namespace Acme.BookStore.EntityFrameworkCore
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(BookStoreConsts.DbTablePrefix + "YourEntities", BookStoreConsts.DbSchema);
// //...
//});
builder.Entity<Book>(b =>
{
b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema);
b.ConfigureExtraProperties();
});
}
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b)

6
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs

@ -2,10 +2,12 @@
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace Acme.BookStore.EntityFrameworkCore
{
@ -16,7 +18,9 @@ namespace Acme.BookStore.EntityFrameworkCore
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(BackgroundJobsEntityFrameworkCoreModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule)
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule)
)]
public class BookStoreEntityFrameworkCoreModule : AbpModule
{

14
samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

@ -27,19 +27,21 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Account.Web" Version="0.15.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Account.Web" Version="0.16.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="0.16.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="0.16.0" />
</ItemGroup>
</Project>

31
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs

@ -20,6 +20,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Data;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
@ -32,6 +33,8 @@ using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.PermissionManagement;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.TenantManagement.Web;
namespace Acme.BookStore
{
@ -41,7 +44,8 @@ namespace Acme.BookStore
typeof(AbpAutofacModule),
typeof(AbpIdentityWebModule),
typeof(AbpAccountWebModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpTenantManagementWebModule)
)]
public class BookStoreWebModule : AbpModule
{
@ -160,6 +164,12 @@ namespace Acme.BookStore
app.UseVirtualFiles();
app.UseAuthentication();
if (BookStoreConsts.IsMultiTenancyEnabled)
{
app.UseMultiTenancy();
}
app.UseAbpRequestLocalization();
app.UseSwagger();
@ -181,22 +191,9 @@ namespace Acme.BookStore
{
AsyncHelper.RunSync(async () =>
{
var identitySeedResult = await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>()
.SeedAsync(
"1q2w3E*"
);
if (identitySeedResult.CreatedAdminRole)
{
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(BookStorePermissions.GetAll())
);
}
await scope.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
});
}
}

9
samples/BookStore/src/Acme.BookStore.Web/Menus/BookStoreMenuContributor.cs

@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Acme.BookStore.Localization.BookStore;
using Volo.Abp.TenantManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
namespace Acme.BookStore.Menus
@ -18,13 +19,19 @@ namespace Acme.BookStore.Menus
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
if (!BookStoreConsts.IsMultiTenancyEnabled)
{
ApplicationMenuItem administration = context.Menu.GetAdministration();
administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName);
}
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<BookStoreResource>>();
context.Menu.Items.Insert(0, new ApplicationMenuItem("BookStore.Home", l["Menu:Home"], "/"));
context.Menu.AddItem(
new ApplicationMenuItem("BooksStore", l["Menu:BookStore"])
.AddItem(new ApplicationMenuItem("BooksStore.Books", l["Menu:Books"], url: "/Books"))
);
);
}
}
}

2404
samples/BookStore/src/Acme.BookStore.Web/package-lock.json

File diff suppressed because it is too large

4
samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj

@ -9,8 +9,8 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<PackageReference Include="Volo.Abp.TestBase" Version="0.15.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.15.0" />
<PackageReference Include="Volo.Abp.TestBase" Version="0.16.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.16.0" />
<ProjectReference Include="..\..\src\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
</ItemGroup>

1
samples/BookStore/test/Acme.BookStore.Application.Tests/BookAppService_Tests.cs

@ -48,6 +48,7 @@ namespace Acme.BookStore
result.Id.ShouldNotBe(Guid.Empty);
result.Name.ShouldBe("New test book 42");
}
[Fact]
public async Task Should_Not_Create_A_Book_Without_Name()
{

12
samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreTestDataBuilder.cs

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
@ -9,14 +10,12 @@ namespace Acme.BookStore
{
public class BookStoreTestDataBuilder : ITransientDependency
{
private readonly IIdentityDataSeeder _identityDataSeeder;
private readonly IDataSeeder _dataSeeder;
private readonly IRepository<Book, Guid> _bookRepository;
public BookStoreTestDataBuilder(
IIdentityDataSeeder identityDataSeeder,
IRepository<Book, Guid> bookRepository)
public BookStoreTestDataBuilder(IDataSeeder dataSeeder, IRepository<Book, Guid> bookRepository)
{
_identityDataSeeder = identityDataSeeder;
_dataSeeder = dataSeeder;
_bookRepository = bookRepository;
}
@ -27,8 +26,7 @@ namespace Acme.BookStore
public async Task BuildInternalAsync()
{
await _identityDataSeeder.SeedAsync("1q2w3E*");
await _dataSeeder.SeedAsync();
await _bookRepository.InsertAsync(
new Book
{

2
samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj

@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<ProjectReference Include="..\Acme.BookStore.Application.Tests\Acme.BookStore.Application.Tests.csproj" />
<ProjectReference Include="..\..\src\Acme.BookStore.Web\Acme.BookStore.Web.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.TestBase" Version="0.15.0" />
<PackageReference Include="Volo.Abp.AspNetCore.TestBase" Version="0.16.0" />
</ItemGroup>
<ItemGroup>

Loading…
Cancel
Save