Browse Source

Merge pull request #16 from abpframework/master

merge
pull/1172/head
Marcelo M 8 years ago
committed by GitHub
parent
commit
d69549ab7e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/en/Samples/Microservice-Demo.md
  2. 13
      docs/zh-Hans/Samples/Microservice-Demo.md
  3. 14
      framework/Volo.Abp.sln
  4. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs
  5. 27
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Properties/launchSettings.json
  6. 35
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo.Abp.AspNetCore.Mvc.UI.Dashboards.csproj
  7. 20
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpAspNetCoreMvcUiDashboardsModule.cs
  8. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpBasicDashboardScriptContributor.cs
  9. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpBasicDashboardStyleContributor.cs
  10. 29
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewComponent.cshtml.cs
  11. 40
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewModel.cs
  12. 26
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml
  13. 49
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardDefinition.cs
  14. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardOptions.cs
  15. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardRenderer.cs
  16. 28
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardWidgetConfiguration.cs
  17. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/IDashboardRenderer.cs
  18. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/WidgetLocation.cs
  19. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/_ViewImports.cshtml
  20. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/AbpAspNetCoreMvcUiPackagesModule.cs
  21. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/jquery-extensions.js
  22. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
  23. 13
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpAspNetCoreMvcUiWidgetsModule.cs
  24. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/IWidgetRenderer.cs
  25. 58
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs
  26. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDimensions.cs
  27. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetOptions.cs
  28. 25
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetRenderer.cs
  29. 19
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs
  30. 10
      framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs
  31. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs
  32. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliOptions.cs
  33. 65
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
  34. 13
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs
  35. 3
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  36. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs
  37. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs
  38. 60
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs
  39. 56
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs
  40. 80
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SwitchEntityFrameworkCoreToMongoDbStep.cs
  41. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs
  42. 13
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
  43. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs
  44. 39
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplate.cs
  45. 29
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplateProjectRenameStep.cs
  46. 196
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs
  47. 16
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MyTemplateChangeConsoleTestClientPortSettingsStep.cs
  48. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs
  49. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs
  50. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
  51. 26
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
  52. 11
      framework/src/Volo.Abp.Cli/Volo/Abp/Cli/AbpCliModule.cs
  53. 36
      framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs
  54. 63
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AutoRegistrationHelper.cs
  55. 21
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs
  56. 56
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
  57. 26
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs
  58. 1
      framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj
  59. 4
      framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs
  60. 4
      framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs
  61. 2
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AsyncCrudAppService.cs
  62. 2
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs
  63. 7
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs
  64. 3
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs
  65. 6
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  66. 7
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs
  67. 47
      framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpBsonClassMapExtensions.cs
  68. 37
      framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs
  69. 32
      framework/test/Volo.Abp.Core.Tests/System/AbpTypeExtensions_Tests.cs
  70. 8
      framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs
  71. 10
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs
  72. 18
      modules/docs/app/VoloDocs.Migrator/Dockerfile
  73. 18
      modules/docs/app/VoloDocs.Web/Dockerfile
  74. 1
      modules/docs/app/VoloDocs.Web/Pages/Index.cshtml
  75. 12
      modules/docs/docker-compose.migrate.yml
  76. 17
      modules/docs/docker-compose.override.yml
  77. 18
      modules/docs/docker-compose.yml
  78. 2
      nupkg/common.ps1
  79. 1
      samples/DashboardDemo/.gitattributes
  80. 255
      samples/DashboardDemo/.gitignore
  81. 74
      samples/DashboardDemo/DashboardDemo.sln
  82. 7
      samples/DashboardDemo/DashboardDemo.sln.DotSettings
  83. 7
      samples/DashboardDemo/common.props
  84. 18
      samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj
  85. 12
      samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemoApplicationAutoMapperProfile.cs
  86. 27
      samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemoApplicationModule.cs
  87. 22
      samples/DashboardDemo/src/DashboardDemo.Application/Permissions/DashboardDemoPermissionDefinitionProvider.cs
  88. 19
      samples/DashboardDemo/src/DashboardDemo.Application/Permissions/DashboardDemoPermissions.cs
  89. 25
      samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj
  90. 11
      samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoConsts.cs
  91. 49
      samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs
  92. 10
      samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/DashboardDemoResource.cs
  93. 10
      samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/en.json
  94. 0
      samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/pt-BR.json
  95. 0
      samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/tr.json
  96. 0
      samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/zh-Hans.json
  97. 13
      samples/DashboardDemo/src/DashboardDemo.Domain/Settings/DashboardDemoSettingDefinitionProvider.cs
  98. 10
      samples/DashboardDemo/src/DashboardDemo.Domain/Settings/DashboardDemoSettings.cs
  99. 53
      samples/DashboardDemo/src/DashboardDemo.Domain/Users/AppUser.cs
  100. 18
      samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj

4
docs/en/Samples/Microservice-Demo.md

@ -168,7 +168,7 @@ These are the actual applications those have user interfaces to interact to the
- **AuthServer.Host**: Host the IdentityServer4 to provide an authentication service to other services and applications. It is a single-sign server and contains the login page.
- **BackendAdminApp.Host**: This is a backend admin application that host UI for Identity and Product management modules.
- **PubicWebSite.Host**: As public web site that contains a simple product list page and blog module UI.
- **PublicWebSite.Host**: As public web site that contains a simple product list page and blog module UI.
- **ConsoleClientDemo**: A simple console application to demonstrate the usage of services from a C# application.
### Gateways / BFFs (Backend for Frontend)
@ -1471,4 +1471,4 @@ ABP provides automatic audit logging which saves every request in detail (who is
All of the services and applications are configured to write audit logs. Audit logs are saved to the MsDemo_Identity SQL database. So, you can query all audit logs of all applications from a single point.
An Audit Log record has a `CorrelationId` property that can be used to track a request. When a service calls another service in a single web request, they both save audit logs with the same `CorrelationId`. See the `AbpAuditLogs` table in the database.
An Audit Log record has a `CorrelationId` property that can be used to track a request. When a service calls another service in a single web request, they both save audit logs with the same `CorrelationId`. See the `AbpAuditLogs` table in the database.

13
docs/zh-Hans/Samples/Microservice-Demo.md

@ -148,7 +148,7 @@ Visual Studio解决方案由多个项目组成,每个项目在系统中具有不
- **AuthServer.Host**: 托管IdentityServer4以向其他服务和应用程序提供身份验证服务. 它是一个单点登录服务器,包含登录页面.
- **BackendAdminApp.Host**: 这是一个后端管理应用程序,用于托管身份和产品管理模块的UI.
- **PubicWebSite.Host**: 作为包含简单产品列表页面和博客模块UI的公共网站.
- **PublicWebSite.Host**: 作为包含简单产品列表页面和博客模块UI的公共网站.
- **ConsoleClientDemo**: 一个简单的控制台应用程序,用于演示C#应用程序中使用服务.
### 网关/BFF(前端后端)
@ -276,8 +276,7 @@ context.Services.AddAuthentication(options =>
* 它将"Cookies"身份验证添加为主要身份验证类型.
* "oidc"身份验证配置为使用AuthServer应用程序作为身份验证服务器.
* 它需要额外的身份范围(scopes) *role*, *email* and *phone*.
* It requires the API resource scopes *BackendAdminAppGateway*, *IdentityService* and *ProductService* because it will use these services as APIs.
* 它需要额外的身份范围(scopes) *role*, *email* 和 *phone*.
* 它需要API资源范围 *BackendAdminAppGateway*, *IdentityService* 和 *ProductService*,因为它将这些服务用作API.
IdentityServer客户端设置存储在`appsettings.json`文件中:
@ -577,8 +576,6 @@ Ocelot需要知道微服务的真实URL才能重定向HTTP请求. 此网关的
`ReRoutes`是一个URL映射数组. `GlobalConfiguration`部分中的`BaseUrl`是该网关的URL(Ocelot需要知道自己的URL). 参见 [ocelot文档](https://ocelot.readthedocs.io/en/latest/features/configuration.html) 更好地了解配置.
Ocelot is a finalizer ASP.NET Core middleware and should be written as the last item in the pipeline:
Ocelot是一个终结ASP.NET核心中间件,应该写成管道中的最后一项:
````csharp
@ -935,7 +932,7 @@ context.Services.AddAuthentication("Bearer")
#### IdentityServer Client
此微服务还通过内部网关使用Identity微服务API, 因为在某些情况下它需要查询用户详细信息(username, email, phone, name and surname). 因此,它也是IdentityServer的客户端,并在`appsettings.json`文件中定义了一个部分:
此微服务还通过内部网关使用Identity微服务API, 因为在某些情况下它需要查询用户详细信息(username, email, phone, name 和 surname). 因此,它也是IdentityServer的客户端,并在`appsettings.json`文件中定义了一个部分:
````json
"IdentityClients": {
@ -1334,7 +1331,7 @@ public async Task<ProductDto> UpdateAsync(Guid id, UpdateProductDto input)
AddDistributedEvent(new ProductStockCountChangedEto(Id, StockCount, stockCount));
````
`ProductStockCountChangedEto` was defined as shown below:
`ProductStockCountChangedEto` 定义如下:
````csharp
[Serializable]
@ -1458,4 +1455,4 @@ ABP提供自动审计日志记录,详细保存每个请求(当前用户,浏览
所有服务和应用程序都配置为编写审核日志. 审核日志将保存到MsDemo_Identity SQL数据库中. 因此,您可以从单个点查询所有应用程序的所有审核日志.
审核日志记录具有`CorrelationId`属性,可用于跟踪请求. 当服务在单个Web请求中调用另一个服务时,它们都会使用相同的`CorrelationId`保存审核日志. 请参阅数据库中的`AbpAuditLogs`表.
审核日志记录具有`CorrelationId`属性,可用于跟踪请求. 当服务在单个Web请求中调用另一个服务时,它们都会使用相同的`CorrelationId`保存审核日志. 请参阅数据库中的`AbpAuditLogs`表.

14
framework/Volo.Abp.sln

@ -234,6 +234,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Specifications.Tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Cli.Core.Tests", "test\Volo.Abp.Cli.Core.Tests\Volo.Abp.Cli.Core.Tests.csproj", "{F006B0B4-F25D-4511-9FB3-F17AA44BDCEA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Mvc.UI.Widgets", "src\Volo.Abp.AspNetCore.Mvc.UI.Widgets\Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj", "{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Mvc.UI.Dashboards", "src\Volo.Abp.AspNetCore.Mvc.UI.Dashboards\Volo.Abp.AspNetCore.Mvc.UI.Dashboards.csproj", "{054D766D-5992-460E-A4D8-936D80BE2C1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -696,6 +700,14 @@ Global
{F006B0B4-F25D-4511-9FB3-F17AA44BDCEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F006B0B4-F25D-4511-9FB3-F17AA44BDCEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F006B0B4-F25D-4511-9FB3-F17AA44BDCEA}.Release|Any CPU.Build.0 = Release|Any CPU
{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A}.Release|Any CPU.Build.0 = Release|Any CPU
{054D766D-5992-460E-A4D8-936D80BE2C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{054D766D-5992-460E-A4D8-936D80BE2C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{054D766D-5992-460E-A4D8-936D80BE2C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{054D766D-5992-460E-A4D8-936D80BE2C1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -815,6 +827,8 @@ Global
{2C621EED-563C-4F81-A75E-50879E173544} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{D078553A-C70C-4F56-B3E2-9C5BA6384C72} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{F006B0B4-F25D-4511-9FB3-F17AA44BDCEA} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{EE1AAB08-3FBD-487F-B0B4-BEBA4B69528A} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{054D766D-5992-460E-A4D8-936D80BE2C1A} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling

27
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:57333/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.UI.Dashboards": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:57343/"
}
}
}

35
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo.Abp.AspNetCore.Mvc.UI.Dashboards.csproj

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Dashboards</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Dashboards</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Volo\Abp\AspNetCore\Mvc\UI\Dashboards\Components\**\*.cshtml" />
<Content Remove="Volo\Abp\AspNetCore\Mvc\UI\Dashboards\Components\**\*.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Remove="Volo\Abp\AspNetCore\Mvc\UI\Dashboards\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Volo\Abp\AspNetCore\Mvc\UI\Dashboards\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Widgets\Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bundling\Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj" />
</ItemGroup>
</Project>

20
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpAspNetCoreMvcUiDashboardsModule.cs

@ -0,0 +1,20 @@
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
[DependsOn(
typeof(AbpAspNetCoreMvcUiWidgetsModule)
)]
public class AbpAspNetCoreMvcUiDashboardsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiDashboardsModule>();
});
}
}
}

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpBasicDashboardScriptContributor.cs

@ -0,0 +1,8 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class AbpBasicDashboardScriptContributor : BundleContributor
{
}
}

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/AbpBasicDashboardStyleContributor.cs

@ -0,0 +1,8 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class AbpBasicDashboardStyleContributor : BundleContributor
{
}
}

29
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewComponent.cshtml.cs

@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard
{
public class DashboardViewComponent : AbpViewComponent
{
private readonly DashboardOptions _dashboardOptions;
private readonly WidgetOptions _widgetOptions;
public DashboardViewComponent(IOptions<DashboardOptions> dashboardOptions, IOptions<WidgetOptions> widgetOptions)
{
_dashboardOptions = dashboardOptions.Value;
_widgetOptions = widgetOptions.Value;
}
public IViewComponentResult Invoke(string dashboardName)
{
var dashboard = _dashboardOptions.Dashboards.Single(d => d.Name.Equals(dashboardName));
var model = new DashboardViewModel(dashboard, _widgetOptions.Widgets);
return View("~/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml", model);
}
}
}

40
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewModel.cs

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard
{
public class DashboardViewModel
{
public DashboardDefinition Dashboard { get; set; }
public List<WidgetDefinition> Widgets { get; set; }
public DashboardViewModel(DashboardDefinition dashboard, List<WidgetDefinition> widgets)
{
Dashboard = dashboard;
Widgets = widgets;
}
public WidgetDefinition GetWidget(string name)
{
return Widgets.Single(d => d.Name.Equals(name));
}
public async Task<bool> CheckPermissionsAsync(IAuthorizationService authorizationService, WidgetDefinition widget)
{
foreach (var permission in widget.RequiredPermissions)
{
if (!await authorizationService.IsGrantedAsync(permission))
{
return false;
}
}
return true;
}
}
}

26
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml

@ -0,0 +1,26 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.Extensions.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets
@inject IAuthorizationService AuthorizationService
@inject IWidgetRenderer WidgetRenderer
@inject IStringLocalizerFactory localizer
@model Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard.DashboardViewModel
@{
}
<abp-row>
@foreach (var widgetConfiguration in Model.Dashboard.AvailableWidgets)
{
var widgetDefinition = Model.GetWidget(widgetConfiguration.WidgetName);
if (await Model.CheckPermissionsAsync(AuthorizationService, widgetDefinition))
{
widgetDefinition.DefaultDimensions = widgetConfiguration.Dimensions ?? widgetDefinition.DefaultDimensions ?? new WidgetDimensions(6, 4);
<abp-column class="col-@(widgetDefinition.DefaultDimensions.Width) p-2"
style="height: @(widgetDefinition.DefaultDimensions.Height * 100)px">
@await WidgetRenderer.RenderAsync(Component, widgetDefinition.Name)
</abp-column>
}
}
</abp-row>

49
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardDefinition.cs

@ -0,0 +1,49 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardDefinition
{
/// <summary>
/// Unique name of the dashboard.
/// </summary>
[NotNull]
public string Name { get; }
/// <summary>
/// A list of Widgets available for this dashboard.
/// </summary>
public List<DashboardWidgetConfiguration> AvailableWidgets { get; }
/// <summary>
/// Display name of the widget.
/// </summary>
[NotNull]
public ILocalizableString DisplayName
{
get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value));
}
private ILocalizableString _displayName;
public DashboardDefinition(
[NotNull] string name,
[CanBeNull] ILocalizableString displayName)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
DisplayName = displayName ?? new FixedLocalizableString(name);
AvailableWidgets = new List<DashboardWidgetConfiguration>();
}
public DashboardDefinition WithWidget(string widgetName, WidgetLocation location = null, WidgetDimensions dimensions = null)
{
AvailableWidgets.Add( new DashboardWidgetConfiguration(widgetName, dimensions, location));
return this;
}
}
}

14
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardOptions.cs

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardOptions
{
public List<DashboardDefinition> Dashboards { get; }
public DashboardOptions()
{
Dashboards = new List<DashboardDefinition>();
}
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardRenderer.cs

@ -0,0 +1,15 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardRenderer : IDashboardRenderer
{
public async Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, object args = null)
{
return await componentHelper.InvokeAsync(typeof(DashboardViewComponent), args ?? new object());
}
}
}

28
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardWidgetConfiguration.cs

@ -0,0 +1,28 @@
using JetBrains.Annotations;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardWidgetConfiguration
{
[NotNull]
public string WidgetName { get; }
[CanBeNull]
public WidgetDimensions Dimensions { get; set; }
[CanBeNull]
public WidgetLocation Location { get; set; }
public DashboardWidgetConfiguration(
[NotNull] string widgetName,
[CanBeNull] WidgetDimensions dimensions = null,
[CanBeNull] WidgetLocation location = null
)
{
WidgetName = Check.NotNullOrWhiteSpace(widgetName, nameof(widgetName));
Dimensions = dimensions;
Location = location;
}
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/IDashboardRenderer.cs

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public interface IDashboardRenderer : ITransientDependency
{
Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, object args = null);
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/WidgetLocation.cs

@ -0,0 +1,15 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class WidgetLocation
{
public int X { get; set; }
public int Y { get; set; }
public WidgetLocation(int x, int y)
{
X = x;
Y = y;
}
}
}

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/_ViewImports.cshtml

@ -0,0 +1,3 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/AbpAspNetCoreMvcUiPackagesModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/jquery-extensions.js

@ -87,7 +87,7 @@
return str;
};
$.fn.serializeFormToObject = function (camelCase = true) {
$.fn.serializeFormToObject = function (camelCase) {
//serialize to array
var data = $(this).serializeArray();
@ -108,7 +108,7 @@
//map to object
var obj = {};
if (camelCase) {
if (camelCase !== undefined ? camelCase : true) {
data.forEach(function (d) {
d.name = toCamelCase(d.name);
});

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Widgets</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Widgets</PackageId>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" />
</ItemGroup>
</Project>

13
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpAspNetCoreMvcUiWidgetsModule.cs

@ -0,0 +1,13 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
[DependsOn(
typeof(AbpAspNetCoreMvcUiBootstrapModule)
)]
public class AbpAspNetCoreMvcUiWidgetsModule : AbpModule
{
}
}

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/IWidgetRenderer.cs

@ -0,0 +1,12 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public interface IWidgetRenderer : ITransientDependency
{
Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, string widgetName, object args = null);
}
}

58
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public class WidgetDefinition
{
/// <summary>
/// Unique name of the widget.
/// </summary>
[NotNull]
public string Name { get; }
/// <summary>
/// Display name of the widget.
/// </summary>
[NotNull]
public ILocalizableString DisplayName
{
get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value));
}
private ILocalizableString _displayName;
[NotNull]
public Type ViewComponentType { get; }
[CanBeNull]
public WidgetDimensions DefaultDimensions { get; set; }
public List<string> RequiredPermissions { get; set; }
public WidgetDefinition(
[NotNull] string name,
[CanBeNull] ILocalizableString displayName,
[NotNull] Type viewComponentType)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
ViewComponentType = Check.NotNull(viewComponentType, nameof(viewComponentType));
DisplayName = displayName ?? new FixedLocalizableString(name);
RequiredPermissions = new List<string>();
}
public WidgetDefinition AddRequiredPermission(string permissionName)
{
RequiredPermissions.Add(permissionName);
return this;
}
public WidgetDefinition SetDefaultDimension(int width, int height)
{
DefaultDimensions = new WidgetDimensions(width, height);
return this;
}
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDimensions.cs

@ -0,0 +1,15 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public class WidgetDimensions
{
public int Width { get; }
public int Height { get; }
public WidgetDimensions(int width, int height)
{
Width = width;
Height = height;
}
}
}

14
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetOptions.cs

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public class WidgetOptions
{
public List<WidgetDefinition> Widgets { get; }
public WidgetOptions()
{
Widgets = new List<WidgetDefinition>();
}
}
}

25
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetRenderer.cs

@ -0,0 +1,25 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public class WidgetRenderer : IWidgetRenderer
{
private readonly WidgetOptions _widgetOptions;
public WidgetRenderer(IOptions<WidgetOptions> widgetOptions)
{
_widgetOptions = widgetOptions.Value;
}
public async Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, string widgetName, object args = null)
{
var widget = _widgetOptions.Widgets.Single(w=>w.Name.Equals(widgetName));
return await componentHelper.InvokeAsync(widget.ViewComponentType, args ?? new object());
}
}
}

19
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs

@ -3,12 +3,14 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Aspects;
using Volo.Abp.AspNetCore.Mvc.Validation;
using Volo.Abp.Features;
using Volo.Abp.Guids;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Timing;
@ -69,6 +71,23 @@ namespace Volo.Abp.AspNetCore.Mvc
public IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
private IFeatureChecker _featureChecker;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L => _localizer ?? (_localizer = StringLocalizerFactory.Create(LocalizationResource));
private IStringLocalizer _localizer;
protected Type LocalizationResource
{
get => _localizationResource;
set
{
_localizationResource = value;
_localizer = null;
}
}
private Type _localizationResource = typeof(DefaultResource);
public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>();
protected virtual void ValidateModel()

10
framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs

@ -23,19 +23,19 @@ namespace Volo.Abp.BackgroundJobs
_jobs = new ConcurrentDictionary<Guid, BackgroundJobInfo>();
}
public Task<BackgroundJobInfo> FindAsync(Guid jobId)
public virtual Task<BackgroundJobInfo> FindAsync(Guid jobId)
{
return Task.FromResult(_jobs.GetOrDefault(jobId));
}
public Task InsertAsync(BackgroundJobInfo jobInfo)
public virtual Task InsertAsync(BackgroundJobInfo jobInfo)
{
_jobs[jobInfo.Id] = jobInfo;
return Task.FromResult(0);
}
public Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount)
public virtual Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount)
{
var waitingJobs = _jobs.Values
.Where(t => !t.IsAbandoned && t.NextTryTime <= Clock.Now)
@ -48,14 +48,14 @@ namespace Volo.Abp.BackgroundJobs
return Task.FromResult(waitingJobs);
}
public Task DeleteAsync(Guid jobId)
public virtual Task DeleteAsync(Guid jobId)
{
_jobs.TryRemove(jobId, out _);
return Task.FromResult(0);
}
public Task UpdateAsync(BackgroundJobInfo jobInfo)
public virtual Task UpdateAsync(BackgroundJobInfo jobInfo)
{
if (jobInfo.IsAbandoned)
{

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs

@ -21,7 +21,7 @@ namespace Volo.Abp.Cli.Auth
{
var accessToken = await AuthenticationService.GetAccessTokenAsync(
new IdentityClientConfiguration(
"https://localhost:44333", //TODO: Configure
CliUrls.AccountAbpIo,
"role email abpio_www abpio_commercial",
"abp-cli",
"1q2w3e*",

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliOptions.cs

@ -7,10 +7,6 @@ namespace Volo.Abp.Cli
{
public Dictionary<string, Type> Commands { get; }
public string AbpIoWwwUrlRoot { get; set; } = "https://abp.io/";
public string AbpIoAccountUrlRoot { get; set; } = "https://account.abp.io/";
public CliOptions()
{
Commands = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);

65
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs

@ -1,5 +1,8 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
@ -7,6 +10,7 @@ using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.NuGet;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli
@ -40,7 +44,9 @@ namespace Volo.Abp.Cli
Logger.LogInformation("https://abp.io");
await CheckForNewVersion();
CheckDependencies();
var commandLineArgs = CommandLineArgumentParser.Parse(args);
var commandType = CommandSelector.Select(commandLineArgs);
@ -63,6 +69,61 @@ namespace Volo.Abp.Cli
}
}
private void CheckDependencies()
{
var installedNpmPackages = GetInstalledNpmPackages();
if (!installedNpmPackages.Contains(" yarn@"))
{
InstallYarn();
}
if (!installedNpmPackages.Contains(" gulp@"))
{
InstallGulp();
}
}
private string GetInstalledNpmPackages()
{
var output = "";
using (var process = new Process())
{
process.StartInfo = new ProcessStartInfo(CmdHelper.GetFileName())
{
Arguments = CmdHelper.GetArguments("npm list -g --depth 0"),
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
process.Start();
using (var stdOut = process.StandardOutput)
{
using (var stdErr = process.StandardError)
{
output = stdOut.ReadToEnd();
output += stdErr.ReadToEnd();
}
}
}
return output;
}
private void InstallYarn()
{
Logger.LogInformation("Installing yarn...");
CmdHelper.RunCmd("npm install yarn -g");
}
private void InstallGulp()
{
Logger.LogInformation("Installing gulp...");
CmdHelper.RunCmd("npm install gulp -g");
}
private async Task CheckForNewVersion()
{
try
@ -86,7 +147,7 @@ namespace Volo.Abp.Cli
Logger.LogWarning(e.Message);
}
}
private static string GetCliVersion()
{
var version = typeof(CliService)

13
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs

@ -0,0 +1,13 @@
namespace Volo.Abp.Cli
{
public static class CliUrls
{
#if DEBUG
public const string WwwAbpIo = "https://localhost:44328/";
public const string AccountAbpIo = "https://localhost:44333/";
#else
public const string WwwAbpIo = "https://abp.io/";
public const string AccountAbpIo = "https://account.abp.io/";
#endif
}
}

3
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -52,8 +52,9 @@ namespace Volo.Abp.Cli.Commands
var result = await ProjectBuilder.BuildAsync(
new ProjectBuildArgs(
SolutionName.Parse(commandLineArgs.Target),
commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long),
GetDatabaseProviderOrNull(commandLineArgs),
commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long)
commandLineArgs.Options
)
);

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs

@ -83,7 +83,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
AddAuthentication(client);
var responseMessage = await client.PostAsync(
Options.AbpIoWwwUrlRoot + "api/download/template/get-version/",
$"{CliUrls.WwwAbpIo}api/download/template/get-version/",
new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json),
CancellationTokenProvider.Token
);
@ -109,7 +109,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
AddAuthentication(client);
var responseMessage = await client.PostAsync(
Options.AbpIoWwwUrlRoot + "api/download/template/",
$"{CliUrls.WwwAbpIo}api/download/template/",
new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json),
CancellationTokenProvider.Token
);

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs

@ -22,7 +22,9 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
public override void Execute(ProjectBuildContext context)
{
context.Files.RemoveAll(file => file.Name.StartsWith(_projectFolderPath));
var projectFolderWithSlash = _projectFolderPath + "/";
context.Files.RemoveAll(file => file.Name.StartsWith(projectFolderWithSlash));
context.Files.RemoveAll(file => file.Name == _projectFolderPath);
var solutionFile = context.GetFile(_solutionFilePath);
solutionFile.NormalizeLineEndings();
solutionFile.SetLines(RemoveProject(solutionFile.GetLines().ToList()));

60
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs

@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{
public static class RenameHelper
{
public static void RenameAll(List<FileEntry> entries, string placeHolder, string name)
{
RenameDirectoryRecursively(entries, placeHolder, name);
RenameAllFiles(entries, placeHolder, name);
ReplaceContent(entries, placeHolder, name);
}
private static void RenameDirectoryRecursively(List<FileEntry> entries, string placeHolder, string name)
{
foreach (var entry in entries.Where(e => e.IsDirectory))
{
if (entry.Name.Contains(placeHolder))
{
entry.SetName(entry.Name.Replace(placeHolder, name));
}
}
}
private static void RenameAllFiles(List<FileEntry> entries, string placeHolder, string name)
{
foreach (var entry in entries.Where(e => !e.IsDirectory))
{
if (entry.Name.Contains(placeHolder))
{
entry.SetName(entry.Name.Replace(placeHolder, name));
}
}
}
private static void ReplaceContent(List<FileEntry> entries, string placeHolder, string name)
{
foreach (var entry in entries.Where(e => !e.IsDirectory))
{
if (entry.Content.Length < placeHolder.Length)
{
continue;
}
if (entry.IsBinaryFile)
{
continue;
}
var newContent = entry.Content.Replace(placeHolder, name);
if (newContent != entry.Content)
{
entry.SetContent(newContent);
}
}
}
}
}

56
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs

@ -52,64 +52,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{
if (_companyNamePlaceHolder != null && _companyName != null)
{
RenameDirectoryRecursively(_companyNamePlaceHolder, _companyName);
RenameAllFiles(_companyNamePlaceHolder, _companyName);
ReplaceContent(_companyNamePlaceHolder, _companyName);
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName);
}
else if (_companyNamePlaceHolder != null)
{
RenameDirectoryRecursively(_companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder);
RenameAllFiles(_companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder);
ReplaceContent(_companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder);
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder);
}
RenameDirectoryRecursively(_projectNamePlaceHolder, _projectName);
RenameAllFiles(_projectNamePlaceHolder, _projectName);
ReplaceContent(_projectNamePlaceHolder, _projectName);
}
private void RenameDirectoryRecursively(string placeHolder, string name)
{
foreach (var entry in _entries.Where(e => e.IsDirectory))
{
if (entry.Name.Contains(placeHolder))
{
entry.SetName(entry.Name.Replace(placeHolder, name));
}
}
}
private void RenameAllFiles(string placeHolder, string name)
{
foreach (var entry in _entries.Where(e => !e.IsDirectory))
{
if (entry.Name.Contains(placeHolder))
{
entry.SetName(entry.Name.Replace(placeHolder, name));
}
}
}
private void ReplaceContent(string placeHolder, string name)
{
foreach (var entry in _entries.Where(e => !e.IsDirectory))
{
if (entry.Content.Length < placeHolder.Length)
{
continue;
}
if (entry.IsBinaryFile)
{
continue;
}
var newContent = entry.Content.Replace(placeHolder, name);
if (newContent != entry.Content)
{
entry.SetContent(newContent);
}
}
RenameHelper.RenameAll(_entries, _projectNamePlaceHolder, _projectName);
}
}
}

80
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SwitchEntityFrameworkCoreToMongoDbStep.cs

@ -1,80 +0,0 @@
using System;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{
public class SwitchEntityFrameworkCoreToMongoDbStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
ChangeProjectReference(context);
ChangeWebModuleUsage(context);
ChangeConnectionString(context);
}
private void ChangeProjectReference(ProjectBuildContext context)
{
var file = context.GetFile("/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj");
file.NormalizeLineEndings();
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("ProjectReference") && lines[i].Contains("MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations"))
{
lines[i] = lines[i].Replace("EntityFrameworkCore.DbMigrations", "MongoDB");
file.SetLines(lines);
return;
}
}
throw new ApplicationException("Could not find the EntityFrameworkCore reference in the MyCompanyName.MyProjectName.Web.csproj!");
}
private void ChangeWebModuleUsage(ProjectBuildContext context)
{
var file = context.GetFile("/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs");
file.NormalizeLineEndings();
file.RemoveTemplateCodeIfNot("EntityFrameworkCore");
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("using MyCompanyName.MyProjectName.EntityFrameworkCore"))
{
lines[i] = "using MyCompanyName.MyProjectName.MongoDb;";
}
else if (lines[i].Contains("MyProjectNameEntityFrameworkCoreModule"))
{
lines[i] = lines[i].Replace("MyProjectNameEntityFrameworkCoreModule", "MyProjectNameMongoDbModule");
}
}
file.SetLines(lines);
}
private void ChangeConnectionString(ProjectBuildContext context)
{
var file = context.GetFile("/src/MyCompanyName.MyProjectName.Web/appsettings.json");
file.NormalizeLineEndings();
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("Default") && lines[i].Contains("Database"))
{
lines[i] = " \"Default\": \"mongodb://localhost:27017|MyProjectName\"";
file.SetLines(lines);
return;
}
}
throw new ApplicationException("Could not find the 'Default' connection string in appsettings.json file!");
}
}
}

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs

@ -4,6 +4,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files
{
public static class FileEntryExtensions
{
public static FileEntry ReplaceText(this FileEntry file, string oldText, string newText)
{
file.NormalizeLineEndings();
file.SetContent(file.Content.Replace(oldText, newText));
return file;
}
public static void RemoveTemplateCode(this FileEntry file)
{
RemoveMarkedTemplateCode(file, "<TEMPLATE-REMOVE>");

13
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs

@ -1,4 +1,5 @@
using JetBrains.Annotations;
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding
@ -13,14 +14,20 @@ namespace Volo.Abp.Cli.ProjectBuilding
public DatabaseProvider DatabaseProvider { get; set; }
[NotNull]
public Dictionary<string, string> ExtraProperties { get; set; }
public ProjectBuildArgs(
[NotNull] SolutionName solutionName,
DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified,
[CanBeNull] string templateName = null)
[CanBeNull] string templateName = null,
DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified,
Dictionary<string, string> extraProperties = null)
{
DatabaseProvider = databaseProvider;
TemplateName = templateName;
SolutionName = Check.NotNull(solutionName, nameof(solutionName));
ExtraProperties = extraProperties ?? new Dictionary<string, string>();
}
}
}

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateInfoProvider.cs

@ -1,6 +1,7 @@
using System;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Templates;
using Volo.Abp.Cli.ProjectBuilding.Templates.Mvc;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.ProjectBuilding

39
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/MvcTemplate.cs → framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplate.cs

@ -2,7 +2,7 @@
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
namespace Volo.Abp.Cli.ProjectBuilding.Templates
namespace Volo.Abp.Cli.ProjectBuilding.Templates.Mvc
{
public class MvcTemplate : TemplateInfo
{
@ -14,14 +14,16 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
public MvcTemplate()
: base(TemplateName, DatabaseProvider.EntityFrameworkCore)
{
}
public override IEnumerable<ProjectBuildPipelineStep> GetCustomSteps(ProjectBuildContext context)
{
var steps = new List<ProjectBuildPipelineStep>();
SwitchDatabaseProvider(context, steps);
RemoveOtherDatabaseProviders(context, steps);
ChangeLocalhostPort(steps);
DeleteUnrelatedProjects(context, steps);
return steps;
}
@ -29,35 +31,38 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
{
if (context.BuildArgs.DatabaseProvider == DatabaseProvider.MongoDb)
{
steps.Add(new SwitchEntityFrameworkCoreToMongoDbStep());
steps.Add(new MvcTemplateSwitchEntityFrameworkCoreToMongoDbStep());
}
}
private static void RemoveOtherDatabaseProviders(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
if (context.BuildArgs.DatabaseProvider != DatabaseProvider.EntityFrameworkCore)
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.EntityFrameworkCore"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Application.Tests", projectFolderPath: "test/MyCompanyName.MyProjectName.Application.Tests"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Tests", projectFolderPath: "test/MyCompanyName.MyProjectName.Web.Tests"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.EntityFrameworkCore.Tests", projectFolderPath: "/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests"));
}
if (context.BuildArgs.DatabaseProvider != DatabaseProvider.MongoDb)
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.MongoDB"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.MongoDB.Tests", projectFolderPath: "/test/MyCompanyName.MyProjectName.MongoDB.Tests"));
}
}
private void ChangeLocalhostPort(List<ProjectBuildPipelineStep> steps)
private void DeleteUnrelatedProjects(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
steps.Add(
new ChangeLocalhostPortStep(
"/src/MyCompanyName.MyProjectName.Web/Properties/launchSettings.json",
53929,
53932
)
);
if (context.BuildArgs.ExtraProperties.ContainsKey("tiered"))
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Tests", projectFolderPath: "/test/MyCompanyName.MyProjectName.Web.Tests"));
steps.Add(new MvcTemplateProjectRenameStep("MyCompanyName.MyProjectName.Web.Host", "MyCompanyName.MyProjectName.Web"));
}
else
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new MyTemplateChangeConsoleTestClientPortSettingsStep());
}
}
}
}

29
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplateProjectRenameStep.cs

@ -0,0 +1,29 @@
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.Mvc
{
public class MvcTemplateProjectRenameStep : ProjectBuildPipelineStep
{
private readonly string _oldProjectName;
private readonly string _newProjectName;
public MvcTemplateProjectRenameStep(
string oldProjectName,
string newProjectName)
{
_oldProjectName = oldProjectName;
_newProjectName = newProjectName;
}
public override void Execute(ProjectBuildContext context)
{
context
.GetFile("/MyCompanyName.MyProjectName.sln")
.ReplaceText(_oldProjectName, _newProjectName);
RenameHelper.RenameAll(context.Files, _oldProjectName, _newProjectName);
}
}
}

196
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MvcTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs

@ -0,0 +1,196 @@
using System;
using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.Mvc
{
public class MvcTemplateSwitchEntityFrameworkCoreToMongoDbStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
//MyCompanyName.MyProjectName.Web
ChangeProjectReference(
context,
"/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj",
"EntityFrameworkCore.DbMigrations",
"MongoDB"
);
ChangeModuleDependency(
context,
"/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs",
"MyCompanyName.MyProjectName.EntityFrameworkCore",
"MyCompanyName.MyProjectName.MongoDb",
"MyProjectNameEntityFrameworkCoreDbMigrationsModule",
"MyProjectNameMongoDbModule"
);
ChangeConnectionStringToMongoDb(
context,
"/src/MyCompanyName.MyProjectName.Web/appsettings.json"
);
//MyCompanyName.MyProjectName.IdentityServer
ChangeProjectReference(
context,
"/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj",
"EntityFrameworkCore.DbMigrations",
"MongoDB"
);
ChangeModuleDependency(
context,
"/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs",
"MyCompanyName.MyProjectName.EntityFrameworkCore",
"MyCompanyName.MyProjectName.MongoDb",
"MyProjectNameEntityFrameworkCoreDbMigrationsModule",
"MyProjectNameMongoDbModule"
);
ChangeConnectionStringToMongoDb(
context,
"/src/MyCompanyName.MyProjectName.IdentityServer/appsettings.json"
);
//MyCompanyName.MyProjectName.HttpApi.Host
ChangeProjectReference(
context,
"/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj",
"EntityFrameworkCore.DbMigrations",
"MongoDB"
);
ChangeModuleDependency(
context,
"/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs",
"MyCompanyName.MyProjectName.EntityFrameworkCore",
"MyCompanyName.MyProjectName.MongoDb",
"MyProjectNameEntityFrameworkCoreDbMigrationsModule",
"MyProjectNameMongoDbModule"
);
ChangeConnectionStringToMongoDb(
context,
"/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json"
);
//MyCompanyName.MyProjectName.DbMigrator
ChangeProjectReference(
context,
"/src/MyCompanyName.MyProjectName.DbMigrator/MyCompanyName.MyProjectName.DbMigrator.csproj",
"EntityFrameworkCore.DbMigrations",
"MongoDB"
);
ChangeModuleDependency(
context,
"/src/MyCompanyName.MyProjectName.DbMigrator/MyProjectNameDbMigratorModule.cs",
"MyCompanyName.MyProjectName.EntityFrameworkCore",
"MyCompanyName.MyProjectName.MongoDb",
"MyProjectNameEntityFrameworkCoreDbMigrationsModule",
"MyProjectNameMongoDbModule"
);
ChangeConnectionStringToMongoDb(
context,
"/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json"
);
//MyCompanyName.MyProjectName.Domain.Tests
ChangeProjectReference(
context,
"/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj",
"EntityFrameworkCore.Tests",
"MongoDB.Tests"
);
ChangeModuleDependency(
context,
"/test/MyCompanyName.MyProjectName.Domain.Tests/MyProjectNameDomainTestModule.cs",
"MyCompanyName.MyProjectName.EntityFrameworkCore",
"MyCompanyName.MyProjectName.MongoDb",
"MyProjectNameEntityFrameworkCoreDbMigrationsModule",
"MyProjectNameMongoDbTestModule"
);
}
private void ChangeProjectReference(
ProjectBuildContext context,
string targetProjectFilePath,
string oldReference,
string newReference)
{
var file = context.GetFile(targetProjectFilePath);
file.NormalizeLineEndings();
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("ProjectReference") && lines[i].Contains(oldReference))
{
lines[i] = lines[i].Replace(oldReference, newReference);
file.SetLines(lines);
return;
}
}
throw new ApplicationException($"Could not find the '{oldReference}' reference in the project '{targetProjectFilePath}'!");
}
private void ChangeModuleDependency(
ProjectBuildContext context,
string targetModuleFilePath,
string oldNamespace,
string newNamespace,
string oldModuleName,
string newModuleName)
{
var file = context.GetFile(targetModuleFilePath);
file.NormalizeLineEndings();
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains($"using {oldNamespace};"))
{
lines[i] = $"using {newNamespace};";
}
else if (lines[i].Contains(oldModuleName))
{
lines[i] = lines[i].Replace(oldModuleName, newModuleName);
}
}
file.SetLines(lines);
}
private void ChangeConnectionStringToMongoDb(
ProjectBuildContext context,
string appsettingFilePath)
{
var file = context.GetFile(appsettingFilePath);
file.NormalizeLineEndings();
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("Default") && lines[i].Contains("Database"))
{
lines[i] = " \"Default\": \"mongodb://localhost:27017|MyProjectName\"";
file.SetLines(lines);
return;
}
}
throw new ApplicationException("Could not find the 'Default' connection string in appsettings.json file!");
}
}
}

16
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Mvc/MyTemplateChangeConsoleTestClientPortSettingsStep.cs

@ -0,0 +1,16 @@
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.Mvc
{
public class MyTemplateChangeConsoleTestClientPortSettingsStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
context
.GetFile("/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json")
.ReplaceText("44395", "44361")
.ReplaceText("44348", "44361");
}
}
}

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.ProjectModification
@ -12,8 +13,7 @@ namespace Volo.Abp.Cli.ProjectModification
var moduleName = ParseModuleName(module);
var migrationName = "Added_" + moduleName + "_Module" + GetUniquePostFix();
var process = Process.Start("CMD.exe", "/C cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef migrations add " + migrationName);
process.WaitForExit();
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef migrations add " + migrationName);
if (updateDatabase)
{
@ -23,8 +23,7 @@ namespace Volo.Abp.Cli.ProjectModification
protected void UpdateDatabase(string csprojFile)
{
var process = Process.Start("CMD.exe", "/C cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef database update");
process.WaitForExit();
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef database update");
}
protected virtual string ParseModuleName(string fullModuleName)

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs

@ -73,7 +73,7 @@ namespace Volo.Abp.Cli.ProjectModification
{
using (var client = new HttpClient())
{
var url = "https://localhost:44328/api/app/nugetPackage/byName/?name=" + moduleName;
var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/byName/?name=" + moduleName;
var response = await client.GetAsync(url);

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

@ -125,7 +125,7 @@ namespace Volo.Abp.Cli.ProjectModification
{
using (var client = new HttpClient())
{
var url = "https://localhost:44328/api/app/module/byName/?name=" + moduleName;
var url = $"{CliUrls.WwwAbpIo}api/app/module/byName/?name=" + moduleName;
var response = await client.GetAsync(url);

26
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs

@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Volo.Abp.Cli.Utils
{
@ -12,8 +13,31 @@ namespace Volo.Abp.Cli.Utils
public static void RunCmd(string command)
{
var procStartInfo = new ProcessStartInfo("cmd.exe", "/C " + command);
var procStartInfo = new ProcessStartInfo(GetFileName(), GetArguments(command));
Process.Start(procStartInfo).WaitForExit();
}
public static string GetArguments(string command)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "-c \"" + command + "\"";
}
//Windows default.
return "/C \"" + command + "\"";
}
public static string GetFileName()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
//TODO: Test this. it should work for both operaion systems.
return "/bin/bash";
}
//Windows default.
return "cmd.exe";
}
}
}

11
framework/src/Volo.Abp.Cli/Volo/Abp/Cli/AbpCliModule.cs

@ -9,15 +9,6 @@ namespace Volo.Abp.Cli
)]
public class AbpCliModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
#if DEBUG
Configure<CliOptions>(options =>
{
options.AbpIoWwwUrlRoot = "https://localhost:44328/";
options.AbpIoAccountUrlRoot = "https://localhost:44333/";
});
#endif
}
}
}

36
framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs

@ -1,4 +1,7 @@
namespace System
using System.Collections.Generic;
using JetBrains.Annotations;
namespace System
{
public static class AbpTypeExtensions
{
@ -31,5 +34,36 @@
{
return targetType.IsAssignableFrom(type);
}
/// <summary>
/// Gets all base classes of this type.
/// </summary>
/// <param name="type">The type to get its base classes.</param>
/// <param name="includeObject">True, to include the standard <see cref="object"/> type in the returned array.</param>
public static Type[] GetBaseClasses(this Type type, bool includeObject = true)
{
var types = new List<Type>();
AddTypeAndBaseTypesRecursively(types, type.BaseType, includeObject);
return types.ToArray();
}
private static void AddTypeAndBaseTypesRecursively(
[NotNull] List<Type> types,
[CanBeNull] Type type,
bool includeObject)
{
if (type == null)
{
return;
}
if (!includeObject && type == typeof(object))
{
return;
}
AddTypeAndBaseTypesRecursively(types, type.BaseType, includeObject);
types.Add(type);
}
}
}

63
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/AutoRegistrationHelper.cs

@ -1,63 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
namespace Volo.Abp.DependencyInjection
{
public static class AutoRegistrationHelper
{
public static IEnumerable<Type> GetExposedServices(IServiceCollection services, Type type)
{
var typeInfo = type.GetTypeInfo();
var customExposedServices = typeInfo
.GetCustomAttributes()
.OfType<IExposedServiceTypesProvider>()
.SelectMany(p => p.GetExposedServiceTypes(type))
.ToList();
if (customExposedServices.Any())
{
return customExposedServices;
}
return GetDefaultExposedServices(services, type);
}
private static IEnumerable<Type> GetDefaultExposedServices(IServiceCollection services, Type type)
{
var serviceTypes = new List<Type>();
serviceTypes.Add(type);
foreach (var interfaceType in type.GetTypeInfo().GetInterfaces())
{
var interfaceName = interfaceType.Name;
if (interfaceName.StartsWith("I"))
{
interfaceName = interfaceName.Right(interfaceName.Length - 1);
}
if (type.Name.EndsWith(interfaceName))
{
serviceTypes.Add(interfaceType);
}
}
var exposeActions = services.GetExposingActionList();
if (exposeActions.Any())
{
var args = new OnServiceExposingContext(type, serviceTypes);
foreach (var action in services.GetExposingActionList())
{
action(args);
}
}
return serviceTypes;
}
}
}

21
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
@ -24,7 +26,11 @@ namespace Volo.Abp.DependencyInjection
return;
}
foreach (var serviceType in AutoRegistrationHelper.GetExposedServices(services, type))
var serviceTypes = ExposedServiceExplorer.GetExposedServices(type);
TriggerServiceExposing(services, type, serviceTypes);
foreach (var serviceType in serviceTypes)
{
var serviceDescriptor = ServiceDescriptor.Describe(serviceType, type, lifeTime.Value);
@ -43,6 +49,19 @@ namespace Volo.Abp.DependencyInjection
}
}
protected virtual void TriggerServiceExposing(IServiceCollection services, Type type, List<Type> serviceTypes)
{
var exposeActions = services.GetExposingActionList();
if (exposeActions.Any())
{
var args = new OnServiceExposingContext(type, serviceTypes);
foreach (var action in exposeActions)
{
action(args);
}
}
}
protected virtual bool IsConventionalRegistrationDisabled(Type type)
{
return type.IsDefined(typeof(DisableConventionalRegistrationAttribute), true);

56
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs

@ -1,19 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Volo.Abp.DependencyInjection
{
public class ExposeServicesAttribute : Attribute, IExposedServiceTypesProvider
{
public Type[] ExposedServiceTypes { get; }
public Type[] ServiceTypes { get; }
public ExposeServicesAttribute(params Type[] exposedServiceTypes)
public bool? IncludeDefaults { get; set; }
public bool? IncludeSelf { get; set; }
public ExposeServicesAttribute(params Type[] serviceTypes)
{
ExposedServiceTypes = exposedServiceTypes ?? new Type[0];
ServiceTypes = serviceTypes ?? new Type[0];
}
public Type[] GetExposedServiceTypes(Type targetType)
{
return ExposedServiceTypes;
var serviceList = ServiceTypes.ToList();
if (IncludeDefaults == true)
{
foreach (var type in GetDefaultServices(targetType))
{
serviceList.AddIfNotContains(type);
}
if (IncludeSelf != false)
{
serviceList.AddIfNotContains(targetType);
}
}
else if (IncludeSelf == true)
{
serviceList.AddIfNotContains(targetType);
}
return serviceList.ToArray();
}
private static List<Type> GetDefaultServices(Type type)
{
var serviceTypes = new List<Type>();
foreach (var interfaceType in type.GetTypeInfo().GetInterfaces())
{
var interfaceName = interfaceType.Name;
if (interfaceName.StartsWith("I"))
{
interfaceName = interfaceName.Right(interfaceName.Length - 1);
}
if (type.Name.EndsWith(interfaceName))
{
serviceTypes.Add(interfaceType);
}
}
return serviceTypes;
}
}
}

26
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Volo.Abp.DependencyInjection
{
public static class ExposedServiceExplorer
{
private static readonly ExposeServicesAttribute DefaultExposeServicesAttribute =
new ExposeServicesAttribute
{
IncludeDefaults = true
};
public static List<Type> GetExposedServices(Type type)
{
return type
.GetCustomAttributes()
.OfType<IExposedServiceTypesProvider>()
.DefaultIfEmpty(DefaultExposeServicesAttribute)
.SelectMany(p => p.GetExposedServiceTypes(type))
.ToList();
}
}
}

1
framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj

@ -15,6 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<ProjectReference Include="..\Volo.Abp.Uow\Volo.Abp.Uow.csproj" />
</ItemGroup>
</Project>

4
framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs

@ -2,9 +2,13 @@
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;
namespace Volo.Abp.Data
{
[DependsOn(
typeof(AbpUnitOfWorkModule)
)]
public class AbpDataModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)

4
framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs

@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
namespace Volo.Abp.Data
{
@ -19,7 +20,8 @@ namespace Volo.Abp.Data
Options = options.Value;
}
public async Task SeedAsync(DataSeedContext context)
[UnitOfWork]
public virtual async Task SeedAsync(DataSeedContext context)
{
using (var scope = ServiceScopeFactory.CreateScope())
{

2
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AsyncCrudAppService.cs

@ -91,7 +91,7 @@ namespace Volo.Abp.Application.Services
var entity = MapToEntity(input);
if(entity is IMultiTenant)
if(entity is IMultiTenant && !HasTenantIdProperty(entity))
{
TryToSetTenantId(entity);
}

2
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs

@ -88,7 +88,7 @@ namespace Volo.Abp.Application.Services
var entity = MapToEntity(input);
if(entity is IMultiTenant)
if(entity is IMultiTenant && !HasTenantIdProperty(entity))
{
TryToSetTenantId(entity);
}

7
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs

@ -156,7 +156,7 @@ namespace Volo.Abp.Application.Services
{
var tenantId = CurrentTenant.Id;
if (tenantId == null)
if (!tenantId.HasValue)
{
return;
}
@ -168,5 +168,10 @@ namespace Volo.Abp.Application.Services
propertyInfo.SetValue(entity, tenantId, null);
}
}
protected virtual bool HasTenantIdProperty(TEntity entity)
{
return entity.GetType().GetProperty(nameof(IMultiTenant.TenantId)) != null;
}
}
}

3
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/IMongoDbRepository.cs

@ -1,4 +1,5 @@
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories.MongoDB
@ -9,6 +10,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
IMongoDatabase Database { get; }
IMongoCollection<TEntity> Collection { get; }
IMongoQueryable<TEntity> GetMongoQueryable();
}
public interface IMongoDbRepository<TEntity, TKey> : IMongoDbRepository<TEntity>, IRepository<TEntity, TKey>

6
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -263,12 +263,10 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
protected override IQueryable<TEntity> GetQueryable()
{
return ApplyDataFilters(
Collection.AsQueryable()
);
return GetMongoQueryable();
}
protected virtual IMongoQueryable<TEntity> GetMongoQueryable()
public virtual IMongoQueryable<TEntity> GetMongoQueryable()
{
return ApplyDataFilters(
Collection.AsQueryable()

7
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDbCoreRepositoryExtensions.cs

@ -1,5 +1,6 @@
using System;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.MongoDB;
@ -19,6 +20,12 @@ namespace Volo.Abp.Domain.Repositories
return repository.ToMongoDbRepository().Collection;
}
public static IMongoQueryable<TEntity> GetMongoQueryable<TEntity, TKey>(this IBasicRepository<TEntity, TKey> repository)
where TEntity : class, IEntity<TKey>
{
return repository.ToMongoDbRepository().GetMongoQueryable();
}
public static IMongoDbRepository<TEntity, TKey> ToMongoDbRepository<TEntity, TKey>(this IBasicRepository<TEntity, TKey> repository)
where TEntity : class, IEntity<TKey>
{

47
framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpBsonClassMapExtensions.cs

@ -1,4 +1,5 @@
using System;
using System.Reflection;
using MongoDB.Bson.Serialization;
using Volo.Abp.Data;
@ -9,34 +10,50 @@ namespace Volo.Abp.MongoDB
public static void ConfigureAbpConventions(this BsonClassMap map)
{
map.AutoMap();
map.ConfigureExtraProperties();
map.TryConfigureExtraProperties();
}
public static void ConfigureExtraProperties<TEntity>(this BsonClassMap<TEntity> map)
public static bool TryConfigureExtraProperties<TEntity>(this BsonClassMap<TEntity> map)
where TEntity : class, IHasExtraProperties
{
var property = map.ClassType.GetProperty(
nameof(IHasExtraProperties.ExtraProperties),
BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty
);
if (property?.DeclaringType != map.ClassType)
{
return false;
}
map.SetExtraElementsMember(new BsonMemberMap(
map,
typeof(TEntity).GetMember(nameof(IHasExtraProperties.ExtraProperties))[0])
);
return true;
}
/// <summary>
/// Configures SetExtraElementsMember if the <see cref="BsonClassMap.ClassType"/>
/// implements the <see cref="IHasExtraProperties"/> interface.
/// Otherwise, does nothing
/// </summary>
public static void ConfigureExtraProperties(this BsonClassMap map)
public static bool TryConfigureExtraProperties(this BsonClassMap map)
{
if (map.ClassType.IsAssignableTo<IHasExtraProperties>())
if (!map.ClassType.IsAssignableTo<IHasExtraProperties>())
{
map.SetExtraElementsMember(
new BsonMemberMap(
map,
map.ClassType.GetMember(nameof(IHasExtraProperties.ExtraProperties))[0]
)
);
return false;
}
var property = map.ClassType.GetProperty(
nameof(IHasExtraProperties.ExtraProperties),
BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty
);
if (property?.DeclaringType != map.ClassType)
{
return false;
}
map.MapExtraElementsMember(property);
return true;
}
}
}

37
framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.MongoDB
{
@ -19,24 +20,40 @@ namespace Volo.Abp.MongoDB
public MongoDbContextModel Build()
{
var entityModels = _entityModelBuilders
.Select(x => x.Value)
.Cast<IMongoEntityModel>()
.ToImmutableDictionary(x => x.EntityType, x => x);
foreach (var entityModel in entityModels.Values)
lock (SyncObj)
{
var map = entityModel.As<IHasBsonClassMap>().GetMap();
lock (SyncObj)
var entityModels = _entityModelBuilders
.Select(x => x.Value)
.Cast<IMongoEntityModel>()
.ToImmutableDictionary(x => x.EntityType, x => x);
var baseClasses = new List<Type>();
foreach (var entityModel in entityModels.Values)
{
var map = entityModel.As<IHasBsonClassMap>().GetMap();
if (!BsonClassMap.IsClassMapRegistered(map.ClassType))
{
BsonClassMap.RegisterClassMap(map);
}
baseClasses.AddRange(entityModel.EntityType.GetBaseClasses(includeObject: false));
}
}
return new MongoDbContextModel(entityModels);
baseClasses = baseClasses.Distinct().ToList();
foreach (var baseClass in baseClasses)
{
if (!BsonClassMap.IsClassMapRegistered(baseClass))
{
var map = new BsonClassMap(baseClass);
map.ConfigureAbpConventions();
BsonClassMap.RegisterClassMap(map);
}
}
return new MongoDbContextModel(entityModels);
}
}
public virtual void Entity<TEntity>(Action<IMongoEntityModelBuilder<TEntity>> buildAction = null)

32
framework/test/Volo.Abp.Core.Tests/System/AbpTypeExtensions_Tests.cs

@ -0,0 +1,32 @@
using Shouldly;
using Xunit;
namespace System
{
public class AbpTypeExtensions_Tests
{
[Fact]
public void GetBaseClasses()
{
var baseClasses = typeof(MyClass).GetBaseClasses(includeObject: false);
baseClasses.Length.ShouldBe(2);
baseClasses[0].ShouldBe(typeof(MyBaseClass1));
baseClasses[1].ShouldBe(typeof(MyBaseClass2));
}
public abstract class MyBaseClass1
{
}
public class MyBaseClass2 : MyBaseClass1
{
}
public class MyClass : MyBaseClass2
{
}
}
}

8
framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs

@ -1,6 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using System.Linq;
using Shouldly;
using Xunit;
namespace Volo.Abp.DependencyInjection
@ -12,7 +10,7 @@ namespace Volo.Abp.DependencyInjection
{
//Act
var exposedServices = AutoRegistrationHelper.GetExposedServices(new ServiceCollection(), typeof(DefaultDerivedService)).ToList();
var exposedServices = ExposedServiceExplorer.GetExposedServices(typeof(DefaultDerivedService));
//Assert
@ -27,7 +25,7 @@ namespace Volo.Abp.DependencyInjection
{
//Act
var exposedServices = AutoRegistrationHelper.GetExposedServices(new ServiceCollection(), typeof(ExplicitDerivedService)).ToList();
var exposedServices = ExposedServiceExplorer.GetExposedServices(typeof(ExplicitDerivedService));
//Assert

10
modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs

@ -19,33 +19,33 @@ namespace Volo.Abp.BackgroundJobs
BackgroundJobRepository = backgroundJobRepository;
}
public async Task<BackgroundJobInfo> FindAsync(Guid jobId)
public virtual async Task<BackgroundJobInfo> FindAsync(Guid jobId)
{
return ObjectMapper.Map<BackgroundJobRecord, BackgroundJobInfo>(
await BackgroundJobRepository.FindAsync(jobId)
);
}
public async Task InsertAsync(BackgroundJobInfo jobInfo)
public virtual async Task InsertAsync(BackgroundJobInfo jobInfo)
{
await BackgroundJobRepository.InsertAsync(
ObjectMapper.Map<BackgroundJobInfo, BackgroundJobRecord>(jobInfo)
);
}
public async Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount)
public virtual async Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount)
{
return ObjectMapper.Map<List<BackgroundJobRecord>, List<BackgroundJobInfo>>(
await BackgroundJobRepository.GetWaitingListAsync(maxResultCount)
);
}
public async Task DeleteAsync(Guid jobId)
public virtual async Task DeleteAsync(Guid jobId)
{
await BackgroundJobRepository.DeleteAsync(jobId);
}
public async Task UpdateAsync(BackgroundJobInfo jobInfo)
public virtual async Task UpdateAsync(BackgroundJobInfo jobInfo)
{
await BackgroundJobRepository.UpdateAsync(
ObjectMapper.Map<BackgroundJobInfo, BackgroundJobRecord>(jobInfo)

18
modules/docs/app/VoloDocs.Migrator/Dockerfile

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build
WORKDIR /src
COPY . .
WORKDIR "/src/modules/docs/app/VoloDocs.Migrator"
RUN dotnet restore -nowarn:msb3202,nu1503
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "VoloDocs.Migrator.dll"]

18
modules/docs/app/VoloDocs.Web/Dockerfile

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build
WORKDIR /src
COPY . .
WORKDIR "/src/modules/docs/app/VoloDocs.Web"
RUN dotnet restore -nowarn:msb3202,nu1503
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "VoloDocs.Web.dll"]

1
modules/docs/app/VoloDocs.Web/Pages/Index.cshtml

@ -12,7 +12,6 @@
@section styles {
<abp-style-bundle name="@typeof(IndexModel).FullName">
<abp-style src="/Pages/Documents/Shared/Styles/vs.css" />
<abp-style src="/assets/fa/css/font-awesome.min.css" />
</abp-style-bundle>
}

12
modules/docs/docker-compose.migrate.yml

@ -0,0 +1,12 @@
version: '3.4'
services:
volo-docs-migrator:
image: 'volosoft/volo-docs-migrator:${TAG:-latest}'
build:
context: ../../
dockerfile: modules/docs/app/VoloDocs.Migrator/Dockerfile
environment:
- ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
depends_on:
- sqlserver

17
modules/docs/docker-compose.override.yml

@ -0,0 +1,17 @@
version: '3.4'
services:
sqlserver:
environment:
- SA_PASSWORD=yourStrong(!)Password
- ACCEPT_EULA=Y
ports:
- "1433:1433"
volo-docs:
environment:
- ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- Title=VoloDocs
- LogoUrl=/assets/images/Logo.png
ports:
- "80:80"

18
modules/docs/docker-compose.yml

@ -0,0 +1,18 @@
version: '3.4'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server
volumes:
- dbdata:/var/opt/mssql
volo-docs:
image: 'volosoft/volo-docs:${TAG:-latest}'
build:
context: ../../
dockerfile: modules/docs/app/VoloDocs.Web/Dockerfile
depends_on:
- sqlserver
volumes:
dbdata:

2
nupkg/common.ps1

@ -37,10 +37,12 @@ $projects = (
"framework/src/Volo.Abp.AspNetCore.Mvc.UI",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared",
"framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets",
"framework/src/Volo.Abp.AspNetCore.TestBase",
"framework/src/Volo.Abp.Auditing",
"framework/src/Volo.Abp.Authorization",

1
samples/DashboardDemo/.gitattributes

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

255
samples/DashboardDemo/.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
# DashboardDemo
src/DashboardDemo.Web/Logs/logs.txt

74
samples/DashboardDemo/DashboardDemo.sln

@ -0,0 +1,74 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Domain", "src\DashboardDemo.Domain\DashboardDemo.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Application", "src\DashboardDemo.Application\DashboardDemo.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.EntityFrameworkCore", "src\DashboardDemo.EntityFrameworkCore\DashboardDemo.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Web", "src\DashboardDemo.Web\DashboardDemo.Web.csproj", "{068855E8-9240-4F1A-910B-CF825794513B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Application.Tests", "test\DashboardDemo.Application.Tests\DashboardDemo.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Web.Tests", "test\DashboardDemo.Web.Tests\DashboardDemo.Web.Tests.csproj", "{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.EntityFrameworkCore.DbMigrations", "src\DashboardDemo.EntityFrameworkCore.DbMigrations\DashboardDemo.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.Build.0 = Release|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.Build.0 = Release|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{068855E8-9240-4F1A-910B-CF825794513B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
EndGlobalSection
EndGlobal

7
samples/DashboardDemo/DashboardDemo.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>

7
samples/DashboardDemo/common.props

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

18
samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>DashboardDemo</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DashboardDemo.Domain\DashboardDemo.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application\Volo.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Application\Volo.Abp.FeatureManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
</ItemGroup>
</Project>

12
samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemoApplicationAutoMapperProfile.cs

@ -0,0 +1,12 @@
using AutoMapper;
namespace DashboardDemo
{
public class DashboardDemoApplicationAutoMapperProfile : Profile
{
public DashboardDemoApplicationAutoMapperProfile()
{
//Configure your AutoMapper mapping configuration here...
}
}
}

27
samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemoApplicationModule.cs

@ -0,0 +1,27 @@
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 DashboardDemo
{
[DependsOn(
typeof(DashboardDemoDomainModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpFeatureManagementApplicationModule)
)]
public class DashboardDemoApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DashboardDemoApplicationAutoMapperProfile>();
});
}
}
}

22
samples/DashboardDemo/src/DashboardDemo.Application/Permissions/DashboardDemoPermissionDefinitionProvider.cs

@ -0,0 +1,22 @@
using DashboardDemo.Localization.DashboardDemo;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
namespace DashboardDemo.Permissions
{
public class DashboardDemoPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var myGroup = context.AddGroup(DashboardDemoPermissions.GroupName);
//Define your own permissions here. Examaple:
//myGroup.AddPermission(DashboardDemoPermissions.MyPermission1, L("Permission:MyPermission1"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<DashboardDemoResource>(name);
}
}
}

19
samples/DashboardDemo/src/DashboardDemo.Application/Permissions/DashboardDemoPermissions.cs

@ -0,0 +1,19 @@
using System;
using Volo.Abp.Reflection;
namespace DashboardDemo.Permissions
{
public static class DashboardDemoPermissions
{
public const string GroupName = "DashboardDemo";
//Add your own permission names. Example:
//public const string MyPermission1 = GroupName + ".MyPermission1";
public static string[] GetAll()
{
//Return an array of all permissions
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DashboardDemoPermissions));
}
}
}

25
samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>DashboardDemo</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Auditing\Volo.Abp.Auditing.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Domain\Volo.Abp.Identity.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\background-jobs\src\Volo.Abp.BackgroundJobs.Domain\Volo.Abp.BackgroundJobs.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.Domain\Volo.Abp.AuditLogging.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Domain\Volo.Abp.TenantManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo.Abp.FeatureManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\DashboardDemo\*.json" />
</ItemGroup>
</Project>

11
samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoConsts.cs

@ -0,0 +1,11 @@
namespace DashboardDemo
{
public static class DashboardDemoConsts
{
public const string DbTablePrefix = "App";
public const string DbSchema = null;
public const bool IsMultiTenancyEnabled = true;
}
}

49
samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs

@ -0,0 +1,49 @@
using DashboardDemo.Localization.DashboardDemo;
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 DashboardDemo
{
[DependsOn(
typeof(AbpIdentityDomainModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpAuditingModule),
typeof(BackgroundJobsDomainModule),
typeof(AbpAuditLoggingDomainModule),
typeof(AbpTenantManagementDomainModule),
typeof(AbpFeatureManagementDomainModule)
)]
public class DashboardDemoDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<DashboardDemoDomainModule>("DashboardDemo");
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<DashboardDemoResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/DashboardDemo");
});
Configure<MultiTenancyOptions>(options =>
{
options.IsEnabled = DashboardDemoConsts.IsMultiTenancyEnabled;
});
}
}
}

10
samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/DashboardDemoResource.cs

@ -0,0 +1,10 @@
using Volo.Abp.Localization;
namespace DashboardDemo.Localization.DashboardDemo
{
[LocalizationResourceName("DashboardDemo")]
public class DashboardDemoResource
{
}
}

10
samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/en.json

@ -0,0 +1,10 @@
{
"culture": "en",
"texts": {
"Menu:Home": "Home",
"Welcome": "Welcome",
"RolesInApplication": "Roles in application",
"UserCount": "User count",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io."
}
}

0
templates/mvc/src/MyCompanyName.MyProjectName.Domain/Localization/MyProjectName/pt-BR.json → samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/pt-BR.json

0
templates/mvc/src/MyCompanyName.MyProjectName.Domain/Localization/MyProjectName/tr.json → samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/tr.json

0
templates/mvc/src/MyCompanyName.MyProjectName.Domain/Localization/MyProjectName/zh-Hans.json → samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/zh-Hans.json

13
samples/DashboardDemo/src/DashboardDemo.Domain/Settings/DashboardDemoSettingDefinitionProvider.cs

@ -0,0 +1,13 @@
using Volo.Abp.Settings;
namespace DashboardDemo.Settings
{
public class DashboardDemoSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
//Define your own settings here. Example:
//context.Add(new SettingDefinition(DashboardDemoSettings.MySetting1));
}
}
}

10
samples/DashboardDemo/src/DashboardDemo.Domain/Settings/DashboardDemoSettings.cs

@ -0,0 +1,10 @@
namespace DashboardDemo.Settings
{
public static class DashboardDemoSettings
{
private const string Prefix = "DashboardDemo";
//Add your own setting names here. Example:
//public const string MySetting1 = Prefix + ".MySetting1";
}
}

53
samples/DashboardDemo/src/DashboardDemo.Domain/Users/AppUser.cs

@ -0,0 +1,53 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Users;
namespace DashboardDemo.Users
{
/* This entity shares the same table/collection ("AbpUsers" by default) with the
* IdentityUser entity of the Identity module.
*
* - You can define your custom properties into this class.
* - You never create or delete this entity, becase it is Identity module's job.
* - You can query users from database with this entity.
* - You can update values of your custom properties.
*/
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser
{
#region Base properties
/* These properties are shared with the IdentityUser entity of the Identity module.
* Do not change these properties through this class. Instead, use Identity module
* services (like IdentityUserManager) to change them.
* So, this properties are designed as read only!
*/
public virtual Guid? TenantId { get; private set; }
public virtual string UserName { get; private set; }
public virtual string Name { get; private set; }
public virtual string Surname { get; private set; }
public virtual string Email { get; private set; }
public virtual bool EmailConfirmed { get; private set; }
public virtual string PhoneNumber { get; private set; }
public virtual bool PhoneNumberConfirmed { get; private set; }
#endregion
/* Add your own properties here. Example:
*
* public virtual string MyProperty { get; set; }
*/
private AppUser()
{
}
}
}

18
samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>DashboardDemo</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20190320072839_Initial.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DashboardDemo.EntityFrameworkCore\DashboardDemo.EntityFrameworkCore.csproj" />
</ItemGroup>
</Project>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save