Browse Source

Merge branch 'dev' into auto-merge/rel-5-1/799

pull/11298/head
maliming 4 years ago
committed by GitHub
parent
commit
b0108e86cc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      common.props
  2. 8
      docs/en/Tutorials/Part-10.md
  3. 1211
      docs/zh-Hans/Tutorials/Part-10.md
  4. 2
      docs/zh-Hans/Tutorials/Part-2.md
  5. 4
      docs/zh-Hans/Tutorials/Part-3.md
  6. 2
      docs/zh-Hans/Tutorials/Part-4.md
  7. 2
      docs/zh-Hans/Tutorials/Part-5.md
  8. 2
      docs/zh-Hans/Tutorials/Part-6.md
  9. 4
      docs/zh-Hans/Tutorials/Part-8.md
  10. 2
      docs/zh-Hans/Tutorials/Part-9.md
  11. BIN
      docs/zh-Hans/Tutorials/images/blazor-bookstore-book-list-with-authors.png
  12. BIN
      docs/zh-Hans/Tutorials/images/book-create-modal-with-author.png
  13. BIN
      docs/zh-Hans/Tutorials/images/bookstore-angular-author-selection.png
  14. BIN
      docs/zh-Hans/Tutorials/images/bookstore-books-with-authorname-angular.png
  15. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/Events/ModuleInstallingProgressEvent.cs
  16. 43
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

2
common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>5.1.1</Version>
<Version>5.2.0</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<PackageIconUrl>https://abp.io/assets/abp_nupkg.png</PackageIconUrl>
<PackageProjectUrl>https://abp.io/</PackageProjectUrl>

8
docs/en/Tutorials/Part-10.md

@ -325,7 +325,7 @@ This new method will be used from the UI to get a list of authors and fill a dro
### BookAppService
Open the `BookAppService` interface in the `Books` folder of the `Acme.BookStore.Application` project and replace the file content with the following code:
Open the `BookAppService` class in the `Books` folder of the `Acme.BookStore.Application` project and replace the file content with the following code:
{{if DB=="EF"}}
@ -449,7 +449,7 @@ namespace Acme.BookStore.Books
{
return sorting.Replace(
"authorName",
"author.Name",
"author.Name",
StringComparison.OrdinalIgnoreCase
);
}
@ -533,7 +533,7 @@ namespace Acme.BookStore.Books
{
input.Sorting = nameof(Book.Name);
}
//Get the IQueryable<Book> from the repository
var queryable = await Repository.GetQueryableAsync();
@ -582,7 +582,7 @@ namespace Acme.BookStore.Books
.ToArray();
var queryable = await _authorRepository.GetQueryableAsync();
var authors = await AsyncExecuter.ToListAsync(
queryable.Where(a => authorIds.Contains(a.Id))
);

1211
docs/zh-Hans/Tutorials/Part-10.md

File diff suppressed because it is too large

2
docs/zh-Hans/Tutorials/Part-2.md

@ -16,7 +16,7 @@
本教程分为以下部分:
- [Part 1: 创建服务端](Part-1.md)
- **Part 2: 图书列表页面**(本章)
- **Part 2: 图书列表页面 (本章)**
- [Part 3: 创建,更新和删除图书](Part-3.md)
- [Part 4: 集成测试](Part-4.md)
- [Part 5: 授权](Part-5.md)

4
docs/zh-Hans/Tutorials/Part-3.md

@ -17,7 +17,7 @@
- [Part 1: 创建服务端](Part-1.md)
- [Part 2: 图书列表页面](Part-2.md)
- **Part 3: 创建,更新和删除图书**(本章)
- **Part 3: 创建,更新和删除图书 (本章)**
- [Part 4: 集成测试](Part-4.md)
- [Part 5: 授权](Part-5.md)
- [Part 6: 作者: 领域层](Part-6.md)
@ -1596,4 +1596,4 @@ namespace Acme.BookStore.Blazor
## 下一章
查看本教程的[下一章](Part-4.md).
查看本教程的[下一章](Part-4.md).

2
docs/zh-Hans/Tutorials/Part-4.md

@ -18,7 +18,7 @@
- [Part 1: 创建服务端](Part-1.md)
- [Part 2: 图书列表页面](Part-2.md)
- [Part 3: 创建,更新和删除图书](Part-3.md)
- **Part 4: 集成测试**(本章)
- **Part 4: 集成测试 (本章)**
- [Part 5: 授权](Part-5.md)
- [Part 6: 作者: 领域层](Part-6.md)
- [Part 7: 作者: 数据库集成](Part-7.md)

2
docs/zh-Hans/Tutorials/Part-5.md

@ -19,7 +19,7 @@
- [Part 2: 图书列表页面](Part-2.md)
- [Part 3: 创建,更新和删除图书](Part-2.md)
- [Part 4: 集成测试](Part-4.md)
- **Part 5: 授权**(本章)
- **Part 5: 授权 (本章)**
- [Part 6: 作者: 领域层](Part-6.md)
- [Part 7: 作者: 数据库集成](Part-7.md)
- [Part 8: 作者: 应用服务层](Part-8.md)

2
docs/zh-Hans/Tutorials/Part-6.md

@ -20,7 +20,7 @@
- [Part 3: 创建,更新和删除图书](Part-2.md)
- [Part 4: 集成测试](Part-4.md)
- [Part 5: 授权](Part-5.md)
- **Part 6: 作者: 领域层**(本章)
- **Part 6: 作者: 领域层 (本章)**
- [Part 7: 作者: 数据库集成](Part-7.md)
- [Part 8: 作者: 应用服务层](Part-8.md)
- [Part 9: 作者: 用户页面](Part-9.md)

4
docs/zh-Hans/Tutorials/Part-8.md

@ -22,7 +22,7 @@
- [Part 5: 授权](Part-5.md)
- [Part 6: 作者: 领域层](Part-6.md)
- [Part 7: 作者: 数据库集成](Part-7.md)
- [Part 8: 作者: 应用服务层](本章)
- **Part 8: 作者: 应用服务层 (本章)**
- [Part 9: 作者: 用户页面](Part-9.md)
- [Part 10: 图书到作者的关系](Part-10.md)
@ -391,7 +391,7 @@ authorsPermission.AddChild(
CreateMap<Author, AuthorDto>();
````
## 种子数据
## 数据种子
如同图书管理部分所做的, 在数据库中生成一些初始作者实体. 不仅当第一次运行应用程序时是有用的, 对自动化测试也是很有用的.

2
docs/zh-Hans/Tutorials/Part-9.md

@ -23,7 +23,7 @@
- [Part 6: 作者: 领域层](Part-6.md)
- [Part 7: 作者: 数据库集成](Part-7.md)
- [Part 8: 作者: 应用服务层](Part-8.md)
- [Part 9: 作者: 用户页面](本章)
- **Part 9: 作者: 用户页面 (本章)**
- [Part 10: 图书到作者的关系](Part-10.md)
## 下载源码

BIN
docs/zh-Hans/Tutorials/images/blazor-bookstore-book-list-with-authors.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
docs/zh-Hans/Tutorials/images/book-create-modal-with-author.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
docs/zh-Hans/Tutorials/images/bookstore-angular-author-selection.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
docs/zh-Hans/Tutorials/images/bookstore-books-with-authorname-angular.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

8
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/Events/ModuleInstallingProgressEvent.cs

@ -0,0 +1,8 @@
namespace Volo.Abp.Cli.ProjectModification.Events;
public class ModuleInstallingProgressEvent
{
public int CurrentStep { get; set; }
public string Message { get; set; }
}

43
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -17,8 +17,10 @@ using Volo.Abp.Cli.Http;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Files;
using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule;
using Volo.Abp.Cli.ProjectModification.Events;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Json;
namespace Volo.Abp.Cli.ProjectModification;
@ -33,6 +35,7 @@ public class SolutionModuleAdder : ITransientDependency
public NewCommand NewCommand { get; }
public BundleCommand BundleCommand { get; }
public ICmdHelper CmdHelper { get; }
public ILocalEventBus LocalEventBus { get; }
protected IJsonSerializer JsonSerializer { get; }
protected ProjectNugetPackageAdder ProjectNugetPackageAdder { get; }
@ -62,7 +65,8 @@ public class SolutionModuleAdder : ITransientDependency
NewCommand newCommand,
BundleCommand bundleCommand,
CliHttpClientFactory cliHttpClientFactory,
ICmdHelper cmdHelper)
ICmdHelper cmdHelper,
ILocalEventBus localEventBus)
{
JsonSerializer = jsonSerializer;
ProjectNugetPackageAdder = projectNugetPackageAdder;
@ -79,6 +83,7 @@ public class SolutionModuleAdder : ITransientDependency
NewCommand = newCommand;
BundleCommand = bundleCommand;
CmdHelper = cmdHelper;
LocalEventBus = localEventBus;
_cliHttpClientFactory = cliHttpClientFactory;
Logger = NullLogger<SolutionModuleAdder>.Instance;
}
@ -95,7 +100,11 @@ public class SolutionModuleAdder : ITransientDependency
Check.NotNull(solutionFile, nameof(solutionFile));
Check.NotNull(moduleName, nameof(moduleName));
await PublishEventAsync(1, "Retriving module info...");
var module = await GetModuleInfoAsync(moduleName, newTemplate, newProTemplate);
await PublishEventAsync(2, "Removing incompatible packages from module...");
module = RemoveIncompatiblePackages(module, version);
Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'");
@ -107,14 +116,20 @@ public class SolutionModuleAdder : ITransientDependency
if (withSourceCode || newTemplate || newProTemplate)
{
var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules");
await PublishEventAsync(5, $"Downloading source code of {moduleName}");
await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version, newTemplate, newProTemplate);
await PublishEventAsync(6, $"Deleting incompatible projects from the module source code");
await RemoveUnnecessaryProjectsAsync(Path.GetDirectoryName(solutionFile), module, projectFiles);
if (addSourceCodeToSolutionFile)
{
await PublishEventAsync(7, $"Adding module to solution file");
await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile);
}
await PublishEventAsync(8, $"Changing nuget references to local references");
if (newTemplate || newProTemplate)
{
await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile, $"{module.Name}.");
@ -133,7 +148,7 @@ public class SolutionModuleAdder : ITransientDependency
await RunBundleForBlazorAsync(projectFiles, module);
ModifyDbContext(projectFiles, module, skipDbMigrations);
await ModifyDbContext(projectFiles, module, skipDbMigrations);
var documentationLink = module.GetFirstDocumentationLinkOrNull();
if (documentationLink != null)
@ -144,6 +159,14 @@ public class SolutionModuleAdder : ITransientDependency
return module;
}
private async Task PublishEventAsync(int currentStep, string message)
{
await LocalEventBus.PublishAsync(new ModuleInstallingProgressEvent {
CurrentStep = currentStep,
Message = message
}, false);
}
private ModuleWithMastersInfo RemoveIncompatiblePackages(ModuleWithMastersInfo module, string version)
{
module.NugetPackages.RemoveAll(np => IsPackageInCompatible(np.MinVersion, np.MaxVersion, version));
@ -195,6 +218,8 @@ public class SolutionModuleAdder : ITransientDependency
return;
}
await PublishEventAsync(10, $"Running bundle command for Blazor");
var args = new CommandLineArgs("bundle");
args.Options.Add(BundleCommand.Options.WorkingDirectory.Short, Path.GetDirectoryName(blazorProject));
@ -381,6 +406,8 @@ public class SolutionModuleAdder : ITransientDependency
if (!angularPackages.IsNullOrEmpty())
{
await PublishEventAsync(5, $"Adding angular package reference");
foreach (var npmPackage in angularPackages)
{
await ProjectNpmPackageAdder.AddAngularPackageAsync(angularPath, npmPackage);
@ -398,6 +425,8 @@ public class SolutionModuleAdder : ITransientDependency
return;
}
await PublishEventAsync(9, $"Adding angular source code");
if (newTemplate)
{
MoveAngularFolderInNewTemplate(modulesFolderInSolution, moduleName);
@ -517,6 +546,7 @@ public class SolutionModuleAdder : ITransientDependency
{
var webPackagesWillBeAddedToBlazorServerProject = SouldWebPackagesBeAddedToBlazorServerProject(module, projectFiles);
await PublishEventAsync(3, "Adding nuget package references");
foreach (var nugetPackage in module.NugetPackages)
{
var isProjectTiered = await IsProjectTiered(projectFiles);
@ -553,9 +583,12 @@ public class SolutionModuleAdder : ITransientDependency
if (!mvcNpmPackages.IsNullOrEmpty())
{
var targetProjects = ProjectFinder.FindNpmTargetProjectFile(projectFiles);
if (targetProjects.Any())
{
await PublishEventAsync(4, "Adding npm package references for MVC");
NpmGlobalPackagesChecker.Check();
foreach (var targetProject in targetProjects)
@ -586,7 +619,7 @@ public class SolutionModuleAdder : ITransientDependency
return isBlazorServerProject && module.NugetPackages.All(np => np.Target != NuGetPackageTarget.BlazorServer && np.TieredTarget != NuGetPackageTarget.BlazorServer);
}
protected void ModifyDbContext(string[] projectFiles, ModuleInfo module, bool skipDbMigrations = false)
protected async Task ModifyDbContext(string[] projectFiles, ModuleInfo module, bool skipDbMigrations = false)
{
if (string.IsNullOrWhiteSpace(module.EfCoreConfigureMethodName))
{
@ -622,6 +655,8 @@ public class SolutionModuleAdder : ITransientDependency
return;
}
await PublishEventAsync(10, $"Adding Configuration to EfCore DbContext");
var addedNewBuilder =
DbContextFileBuilderConfigureAdder.Add(dbContextFile, module.EfCoreConfigureMethodName);
@ -629,9 +664,11 @@ public class SolutionModuleAdder : ITransientDependency
{
if (addedNewBuilder)
{
await PublishEventAsync(11, $"Creating a new migration");
EfCoreMigrationManager.AddMigration(dbMigrationsProject, module.Name);
}
await PublishEventAsync(12, $"Running migrator");
RunMigrator(projectFiles);
}
}

Loading…
Cancel
Save