Browse Source

Merge remote-tracking branch 'abpframework/master' into Translate

pull/1022/head
liangshiwei 7 years ago
parent
commit
34a68efcd9
  1. 3
      .gitignore
  2. 2
      abp_io/Volo.AbpWebSite.sln
  3. 1
      abp_io/src/Volo.AbpWebSite.Web/Pages/Index.cshtml
  4. 1
      abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj
  5. 4
      abp_io/src/Volo.AbpWebSite.Web/compilerconfig.json
  6. 3
      abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.css
  7. 2
      abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.min.css
  8. 10
      abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.scss
  9. 2
      common.props
  10. 177
      docs/en/Apps/VoloDocs.md
  11. 4
      docs/en/AspNetCore/Auto-API-Controllers.md
  12. 6
      docs/en/AspNetCore/Bundling-Minification.md
  13. 3
      docs/en/Best-Practices/Application-Services.md
  14. 7
      docs/en/Modules/Docs.md
  15. 14
      docs/en/Tutorials/AspNetCore-Mvc/Part-I.md
  16. BIN
      docs/en/images/docs-create-project.jpg
  17. BIN
      docs/en/images/github-access-token-private-repo.jpg
  18. BIN
      docs/en/images/github-access-token-public-repo.jpg
  19. BIN
      docs/en/images/github-myusername.jpg
  20. BIN
      docs/en/images/volodocs-iis-add-website.png
  21. BIN
      docs/en/images/volodocs-iis-application-pool.png
  22. 46
      docs/zh-Hans/AspNetCore/Bundling-Minification.md
  23. 3
      docs/zh-Hans/Best-Practices/Application-Services.md
  24. 54
      docs/zh-Hans/Exception-Handling.md
  25. 66
      docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md
  26. 20
      docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md
  27. 2
      docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md
  28. 41
      framework/Volo.Abp.sln
  29. 25
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs
  30. 24
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj
  31. 11
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs
  32. 3
      framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj
  33. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs
  34. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
  35. 12
      framework/src/Volo.Abp.Cli/Program.cs
  36. 12
      framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
  37. 24
      framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
  38. 46
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs
  39. 25
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationModule.cs
  40. 55
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentMethodInvocationValidator.cs
  41. 6
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
  42. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json
  43. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json
  44. 8
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs
  45. 4
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationOptions.cs
  46. 4
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/IMethodInvocationValidator.cs
  47. 32
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs
  48. 3
      framework/src/Volo.Abp/README.md
  49. 19
      framework/src/Volo.Abp/Volo.Abp.csproj
  50. 21
      framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj
  51. 206
      framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs
  52. 31
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml
  53. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.css
  54. 1
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.min.css
  55. 10
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.scss
  56. 8
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.css
  57. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.min.css
  58. 92
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.scss
  59. 8
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css
  60. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.min.css
  61. 4
      modules/blogging/src/Volo.Blogging.Web/compilerconfig.json
  62. 10
      modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs
  63. 2
      modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj
  64. 10
      modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj
  65. 8
      modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj
  66. 6
      modules/docs/README.md
  67. 35
      modules/docs/Volo.Docs.sln
  68. 4
      modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml
  69. 16
      modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml.cs
  70. 6
      modules/docs/app/Volo.DocsTestApp/appsettings.json
  71. 6
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs
  72. 2
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs
  73. 8
      modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs
  74. 1
      modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj
  75. 6
      modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsDbContext.cs
  76. 14
      modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsDbContextFactory.cs
  77. 4
      modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsEntityFrameworkCoreModule.cs
  78. 13
      modules/docs/app/VoloDocs.Migrator/AppExtensions.cs
  79. 1
      modules/docs/app/VoloDocs.Migrator/Migrate.bat
  80. 94
      modules/docs/app/VoloDocs.Migrator/Program.cs
  81. 27
      modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj
  82. 29
      modules/docs/app/VoloDocs.Migrator/VoloDocsMigratorModule.cs
  83. 3
      modules/docs/app/VoloDocs.Migrator/appsettings.json
  84. 29
      modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs
  85. 2
      modules/docs/app/VoloDocs.Web/Controllers/HomeController.cs
  86. 9
      modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/en.json
  87. 9
      modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/tr.json
  88. 14
      modules/docs/app/VoloDocs.Web/Pages/Error.cshtml
  89. 64
      modules/docs/app/VoloDocs.Web/Pages/Error.cshtml.cs
  90. 56
      modules/docs/app/VoloDocs.Web/Pages/Index.cshtml
  91. 38
      modules/docs/app/VoloDocs.Web/Pages/Index.cshtml.cs
  92. 0
      modules/docs/app/VoloDocs.Web/Pages/_ViewImports.cshtml
  93. 2
      modules/docs/app/VoloDocs.Web/Program.cs
  94. 2
      modules/docs/app/VoloDocs.Web/Properties/launchSettings.json
  95. 4
      modules/docs/app/VoloDocs.Web/Startup.cs
  96. 45
      modules/docs/app/VoloDocs.Web/Utils/GlobalExceptionHandlerMiddleware.cs
  97. 20
      modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj
  98. 73
      modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs
  99. 0
      modules/docs/app/VoloDocs.Web/abp.resourcemapping.js
  100. 5
      modules/docs/app/VoloDocs.Web/appsettings.json

3
.gitignore

@ -267,7 +267,7 @@ framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Logs/*.*
modules/blog/app/Volo.BlogTestApp/Logs/*.*
modules/blogging/app/Volo.BloggingTestApp/Logs/*.*
modules/blogging/app/Volo.BloggingTestApp/wwwroot/files/*.*
modules/docs/app/Volo.DocsTestApp/Logs/*.*
modules/docs/app/VoloDocs.Web/Logs/*.*
samples/BookStore/src/Acme.BookStore.Web/Logs/*.*
templates/module/app/MyCompanyName.MyProjectName.DemoApp/Logs/*.*
templates/mvc/src/MyCompanyName.MyProjectName.Web/Logs/*.*
@ -294,3 +294,4 @@ samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/Logs/logs.txt
samples/MicroserviceDemo/applications/PublicWebSite.Host/Logs/logs.txt
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/Logs/logs.txt
samples/MicroserviceDemo/microservices/BloggingService.Host/Logs/logs.txt
modules/docs/app/Volo.DocsTestApp/Logs/logs.txt

2
abp_io/Volo.AbpWebSite.sln

@ -11,7 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.AbpWebSite.Application
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.AbpWebSite.EntityFrameworkCore", "src\Volo.AbpWebSite.EntityFrameworkCore\Volo.AbpWebSite.EntityFrameworkCore.csproj", "{028C05DB-61BF-41EF-B9AD-614A43CD0A7F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Utils.SolutionTemplating", "src\Volo.Utils.SolutionTemplating\Volo.Utils.SolutionTemplating.csproj", "{742FCDDD-537C-42CC-AF16-A92C094D4B1D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Utils.SolutionTemplating", "src\Volo.Utils.SolutionTemplating\Volo.Utils.SolutionTemplating.csproj", "{742FCDDD-537C-42CC-AF16-A92C094D4B1D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

1
abp_io/src/Volo.AbpWebSite.Web/Pages/Index.cshtml

@ -1,5 +1,4 @@
@page
@using Volo.AbpWebSite
@model Volo.AbpWebSite.Pages.IndexModel
@{
Layout = "~/Pages/Shared/HomePageLayout.cshtml";

1
abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj

@ -54,6 +54,7 @@
<ItemGroup>
<Folder Include="Downloads\" />
<Folder Include="wwwroot\assets\applications\" />
</ItemGroup>
</Project>

4
abp_io/src/Volo.AbpWebSite.Web/compilerconfig.json

@ -2,5 +2,9 @@
{
"outputFile": "wwwroot/scss/vs.css",
"inputFile": "wwwroot/scss/vs.scss"
},
{
"outputFile": "Pages/Applications.css",
"inputFile": "Pages/Applications.scss"
}
]

3
abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.css

@ -694,3 +694,6 @@ span.code-arrow {
body {
background-size: cover; }
.applications-container .card-body p {
min-height: 7em; }

2
abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.min.css

File diff suppressed because one or more lines are too long

10
abp_io/src/Volo.AbpWebSite.Web/wwwroot/scss/vs.scss

@ -19,4 +19,12 @@
body {
background-size: cover;
}
}
.applications-container {
.card-body {
p {
min-height: 7em;
}
}
}

2
common.props

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

177
docs/en/Apps/VoloDocs.md

@ -0,0 +1,177 @@
# VoloDocs
## What is VoloDocs?
VoloDocs is a cross-platform web application that allows you to easily create beautiful documentation and build developer communities. It simplifies software documentation with the help of GitHub integration. You use the power of GitHub for versioning, hosting of your docs. You let your users to edit a document.
## Main Features
- Serves documents from your GitHub repository.
- Supports Markdown / HTML document formatting.
- Supports versioning (integrated to GitHub releases).
- Supports multiple projects.
- Allows users to edit a document on GitHub.
- Cross-platform; deployable to Windows / Linux / macOS.
## GitHub Repository
It's free & open-source. You can browse VoloDocs source-code and contribute on GitHub:
https://github.com/abpframework/abp/tree/master/modules/docs
## Download
You can download the VoloDocs release from the following links:
http://apps.abp.io/VoloDocs/VoloDocs.win-x64.zip - **Windows 64 bit**
http://apps.abp.io/VoloDocs/VoloDocs.win-x86.zip - **Windows 32 bit**
http://apps.abp.io/VoloDocs/VoloDocs.osx-x64.zip - **MacOS**
http://apps.abp.io/VoloDocs/VoloDocs.linux-x64.zip - **Linux**
Notice that, all installations are self-contained deployments. It means all the required third-party dependencies along with the version of .NET Core is included. So you don't need to install any .NET Core SDK / Runtime.
## Folder Structure
When you extract the `VoloDocs.*.zip` file, you will see a `Web` folder and a `Migrator` folder. The `Web` folder contains the website files and `Migrator` contains the application to build your database. Before publishing your website, you need to create a new database or update your existing database to the latest. If this is the first time you install VoloDocs, `Migrator` will create a new database for you, otherwise it updates to the latest version. The only setting you need to configure, is the `ConnectionString` which is located in the `appsettings.json` file. See the next section to learn how to configure your VoloDocs application.
## Steps by Step Deployment
- ### Database Migration
To update your existing database or create your initial database, go to `Migrator` folder in your VoloDocs directory.
Open `appsettings.json` in your text editor and set your database connection string. If you don't know how to write the connection string for your database system, you can check out https://www.connectionstrings.com/.
After you set your connection string, run `Migrate.bat` for Windows platform and `VoloDocs.Migrator` for other operating systems. That's it now configure your website.
- ### Configuring Website
Go to `Web` folder in your VoloDocs directory. Open `appsettings.json` in your text editor. Set your connection string (same as in the `Migrator`'s `appsettings.json`). Set `title` of your website. This will be written on the left-upper corner of your website. That's it! Now you can publish your website.
If you want to run
- ### Deploying Website
In the previous step, you created or updated your database. Ensure that your database exists on the specified connection string.
- #### Deploying to IIS
- Move `Web` folder to your `wwwroot ` folder.
- Rename `Web` folder to `VoloDocs` (Now you have `C:\inetpub\wwwroot\VoloDocs`).![Add IIS Website](../images/volodocs-iis-add-website.png)
- The `VoloDocs` application pool is being created automatically. Open **Application Pools** and double click `VoloDocs` application pool and set
- **.NET CLR version**: `No Managed Code`
- **Managed pipeline mode**: `Integrated`
![Add IIS Website](../images/volodocs-iis-application-pool.png)
- If you get the below error, it means don't have the hosting bundle installed on the server. See [this document](https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/#install-the-net-core-hosting-bundle) to learn how to install it or [download Hosting Bundle](https://www.microsoft.com/net/permalink/dotnetcore-current-windows-runtime-bundle-installer) and run on your server.
```
Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list using IIS
```
- Further information about hosting VoloDocs check out [Microsoft's official document for hosting ASP.NET Core application on IIS](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis).
- #### Deploying to Azure
Microsoft has a good document on how to deploy your ASP.NET Core web app to Azure App Service. We recommend you to read this document https://docs.microsoft.com/en-us/azure/app-service/app-service-web-get-started-dotnet.
- #### Running the Application From Command Line
Alternatively you can run the application from command line, navigate to `VoloDocs\Web` folder and run `VoloDocs.Web.exe` for Windows or `VoloDocs.Web` for MacOS / Linux.
- ### First Run
To start the website, navigate to your address (as configured in the previous section).
When you first open the website, you need to create a project.
#### Creating a Project
Go to the following address to create project
- `http://<yourwebsite>/Account/Login?returnUrl=/Docs/Admin/Projects`
##### Default credentials
To login the admin side, use the following credentials:
* **Username**: `admin`
* **Password**: `1q2w3E*`
##### An example project definition
Here's a sample project information that uses GitHub source.
We will configure the VoloDocs to show ABP Framework's documentation that's stored in GitHub.
Here's the link to ABP Framework GitHub docs folder:
https://github.com/abpframework/abp/tree/master/docs/en
* **Name**: `ABP Framework`
* **Short name**: `abp`
* **Format**: `markdown`
* **Default document name**: `Index`
* **Navigation document name**: `docs-nav.json` ([see the sample navigation](https://github.com/abpframework/abp/blob/master/docs/en/docs-nav.json))
* **Minimum version**: *leave empty* *(hides the previous versions)*
* **Main web site URL**: `/`
* **Latest version branch name**: leave empty ()
* **GitHub root URL**: `https://github.com/abpframework/abp/tree/{version}/docs/en/`
* **GitHub access token**: [see how to retrieve GitHub access token](#retrieving-github-access-token)
* **GitHub user agent**: [see how to learn your GitHub username](#learn-your-github-username)
![Creating a new project](../images/docs-create-project.jpg)
##### Retrieving GitHub Access Token
To create a personal access token in GitHub, you need to visit the **Settings** of the user account and under **Developer settings** you will find **Personal access tokens**. Select **Generate new token**, enter in a name as the Token description and enable the repo checkbox. Alternatively, to enter generate new token, browse to https://github.com/settings/tokens/new.
###### Generate Token for Public Repositories
To access public repositories, check `public_repo` under the `repo` section. This will enable VoloDocs to access your public GitHub repositories. Click `Generate Token` button on the bottom of the page.
![Retrieve GitHub Access Token for Public Repo](../images/github-access-token-public-repo.jpg)
###### Generate Token for Private Repositories
To access public repositories, check all items under the `repo` section. This will enable VoloDocs to access your private GitHub repositories. Click `Generate Token` button on the bottom of the page.
![Retrieve GitHub Access Token for Private Repo](../images/github-access-token-private-repo.jpg)
###### Learn Your GitHub Username
To learn your GitHub username, click on your profile picture on the top-right corner of the GitHub page. You will see your username right after the text "Signed in as ..."
![Your GitHub Username](../images/github-myusername.jpg)
After you save the project, go to root website address and you will see your documentation.
`http://<yourwebsite>/documents`
### Any Issues?
If you encounter any problem or issues about installation, usage or report a bug, follow the link:
https://github.com/abpframework/abp/issues/new

4
docs/en/AspNetCore/Auto-API-Controllers.md

@ -80,7 +80,7 @@ Then the route for getting a book will be '**/api/volosoft/book-store/book/{id}*
* Removing '**Async**' postfix. If the method name is 'GetPhonesAsync' then it becomes 'GetPhones'.
* Removing **HTTP method prefix**. 'GetList', 'GetAll', 'Get', 'Put', 'Update', 'Delete', 'Remove', 'Create', 'Add', 'Insert', 'Post' and 'Patch' prefixes are removed based on the selected HTTP method. So, 'GetPhones' becomes 'Phones' since 'Get' prefix is a duplicate for a GET request.
* Converting the result to **camelCase**.
* If the resulting action name is **empty** then it's not added to the route. If it's not empty, it's added to the route (like '/phones'). For 'GetAllAsync' method name it will be empty, for 'GetPhonesAsync' method name is will be 'phones'.
* If the resulting action name is **empty** then it's not added to the route. If it's not empty, it's added to the route (like '/phones'). For 'GetAllAsync' method name it will be empty, for 'GetPhonesAsync' method name it will be 'phones'.
* Normalization can be customized by setting the `UrlActionNameNormalizer` option. It's an action delegate that is called for every method.
* If there is another parameter with 'Id' postfix, then it's also added to the route as the final route segment (like '/phoneId').
@ -135,4 +135,4 @@ public class PersonAppService : ApplicationService
}
````
Disabled `IsMetadataEnabled` which hides this service from API explorer and it will not be discoverable. However, it still can be usable for the clients know the exact API path/route.
Disabled `IsMetadataEnabled` which hides this service from API explorer and it will not be discoverable. However, it still can be usable for the clients know the exact API path/route.

6
docs/en/AspNetCore/Bundling-Minification.md

@ -194,7 +194,7 @@ services.Configure<BundlingOptions>(options =>
options
.ScriptBundles
.Configure("MyGlobalBundle", bundle => {
bundle.AddContributors(typeof(MyExtensionStyleBundleContributor));
bundle.AddContributors(typeof(MyExtensionGlobalStyleContributor));
});
});
````
@ -279,9 +279,9 @@ public class MyExtensionStyleBundleContributor : BundleContributor
Using the built-in contributors for standard packages;
* Prevents you typing **invalid the resource paths**.
* Prevents you typing **the invalid resource paths**.
* Prevents changing your contributor if the resource **path changes** (the dependant contributor will handle it).
* Prevents multiple modules adding the **duplicate the files**.
* Prevents multiple modules adding the **duplicate files**.
* Manages **dependencies recursively** (adds dependencies of dependencies, if necessary).
#### Volo.Abp.AspNetCore.Mvc.UI.Packages Package

3
docs/en/Best-Practices/Application-Services.md

@ -203,12 +203,13 @@ This method votes a question and returns the current score of the question.
#### Manipulating / Deleting Entities
* **Do** always get all the related entities from repositories to perform the operations on them.
* **Do** call repository's Update/UpdateAsync method after updating an entity. Because, not all database APIs support change tracking & auto update.
#### Using Other Application Services
* **Do not** use other application services of the same module/application. Instead;
* Use domain layer to perform the required task.
* Extract a new class and share between the application services to accomplish the code reuse when necessary.
* Extract a new class and share between the application services to accomplish the code reuse when necessary. But be careful to don't couple two use cases. They may seem similar at the beginning, but may evolve to different directions by time. So, use code sharing carefully.
* **Can** use application services of others only if;
* They are parts of another module / microservice.
* The current module has only reference to the application contracts of the used module.

7
docs/en/Modules/Docs.md

@ -472,4 +472,9 @@ The upper sample `JSON` file renders the below navigation menu as `HTML`.
Finally a new Docs Module is added to your project which is feeded with GitHub.
Finally a new Docs Module is added to your project which is feeded with GitHub.
## Next
Docs Module is also available as a standalone application. Check out [VoloDocs](../Apps/VoloDocs).

14
docs/en/Tutorials/AspNetCore-Mvc/Part-I.md

@ -84,11 +84,23 @@ EF Core requires you to relate entities with your DbContext. The easiest way to
````C#
public class BookStoreDbContext : AbpDbContext<BookStoreDbContext>
{
public DbSet<Book> Book { get; set; }
public DbSet<Book> Books { get; set; }
...
}
````
#### Configure Your Book Entity
Open BookStoreDbContextModelCreatingExtensions.cs file from the `Acme.BookStore.EntityFrameworkCore` project, add following code to the end of ConfigureBookStore method to configure Book entity:
````C#
builder.Entity<Book>(b =>
{
b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema);
b.ConfigureExtraProperties();
});
````
#### Add New Migration & Update the Database
The Startup template uses [EF Core Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/) to create and maintain the database schema. Open the **Package Manager Console (PMC)** (under the *Tools/Nuget Package Manager* menu), select the `Acme.BookStore.EntityFrameworkCore.DbMigrations` as the **default project** and execute the following command:

BIN
docs/en/images/docs-create-project.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
docs/en/images/github-access-token-private-repo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
docs/en/images/github-access-token-public-repo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
docs/en/images/github-myusername.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
docs/en/images/volodocs-iis-add-website.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
docs/en/images/volodocs-iis-application-pool.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

46
docs/zh-Hans/AspNetCore/Bundling-Minification.md

@ -196,7 +196,7 @@ services.Configure<BundlingOptions>(options =>
options
.ScriptBundles
.Configure("MyGlobalBundle", bundle => {
bundle.AddContributors(typeof(MyExtensionStyleBundleContributor));
bundle.AddContributors(typeof(MyExtensionGlobalStyleContributor));
});
});
````
@ -214,7 +214,7 @@ services.Configure<BundlingOptions>(options =>
`abp-style`和`abp-script`标签可以使用`type`属性(而不是`src`属性), 如本示例所示. 添加bundle贡献者时, 其依赖关系也会自动添加到bundle中.
#### Contributor Dependencies
#### 贡献者依赖关系
bundle贡献者可以与其他贡献者具有一个或多个依赖关系.
例如:
@ -227,9 +227,39 @@ public class MyExtensionStyleBundleContributor : BundleContributor
}
````
添加bundle贡献者时,其依赖关系将 **自动并递归** 添加. **依赖顺序** 通过阻止 **重复** 添加的依赖关系. 即使它们处于分离的中,也会阻止重复. ABP在页面中组织所有bundle并消除重复.
添加bundle贡献者时,其依赖关系将 **自动并递归** 添加. **依赖顺序** 通过阻止 **重复** 添加的依赖关系. 即使它们处于分离的bundle中,也会阻止重复. ABP在页面中组织所有bundle并消除重复.
创建贡献者和定义依赖关系是一种跨不同模块组织包创建的方法.
创建贡献者和定义依赖关系是一种跨不同模块组织bundle创建的方法.
#### 贡献者扩展
在某些高级应用场景中, 当用到一个bundle贡献者时,你可能想做一些额外的配置. 贡献者扩展可以和被扩展的贡献者无缝衔接.
下面的示例为 prism.js 脚本库添加一些样式:
````csharp
public class MyPrismjsStyleExtension : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/prismjs/plugins/toolbar/prism-toolbar.css");
}
}
````
然后你可以配置 `BundleContributorOptions` 去扩展已存在的 `PrismjsStyleBundleContributor`.
````csharp
Configure<BundleContributorOptions>(options =>
{
options
.Extensions<PrismjsStyleBundleContributor>()
.Add<MyPrismjsStyleExtension>();
});
````
任何时候当 `PrismjsStyleBundleContributor` 被添加到bundle中时, `MyPrismjsStyleExtension` 也会被自动添加.
#### 访问 IServiceProvider
@ -239,7 +269,7 @@ public class MyExtensionStyleBundleContributor : BundleContributor
将特定的NPM包资源(js,css文件)添加到包中对于该包非常简单. 例如, 你总是为bootstrap NPM包添加`bootstrap.css`文件.
所有[标准NPM包](Client-Side-Package-Management.md)都有内置的贡献者. 例如,如果你的贡献者依赖于引导程序,你可以声明它,而不是自己添加bootstrap.css.
所有[标准NPM包](Client-Side-Package-Management.md)都有内置的贡献者. 例如,如果你的贡献者依赖于bootstrap,你可以声明它,而不是自己添加bootstrap.css.
````C#
[DependsOn(typeof(BootstrapStyleContributor))] //Define the bootstrap style dependency
@ -261,7 +291,7 @@ public class MyExtensionStyleBundleContributor : BundleContributor
> 默认情况下已在启动模板安装此软件包. 大多数情况下,你不需要手动安装它.
标准包贡献者在`Volo.Abp.AspNetCore.Mvc.UI.Packages` NuGet包中定义.
安装到你的项目中:
将它安装到你的项目中:
````
install-package Volo.Abp.AspNetCore.Mvc.UI.Packages
@ -283,9 +313,9 @@ namespace MyCompany.MyProject
}
````
#### Bundle Inheritance
#### Bundle 继承
在某些特定情况下, 可能需要从其他bundle创建一个 **新** bundle **继承**, 从bundle继承(递归)继承该bundle的所有文件/贡献者. 然后派生的bundle可以添加或修改文件/贡献者**而无需修改**原始.
在某些特定情况下, 可能需要从其他bundle创建一个 **新** bundle **继承**, 从bundle继承(递归)继承该bundle的所有文件/贡献者. 然后派生的bundle可以添加或修改文件/贡献者**而无需修改**原始bundle.
例如:
````c#

3
docs/zh-Hans/Best-Practices/Application-Services.md

@ -202,12 +202,13 @@ Task<int> VoteAsync(Guid id, VoteType type);
#### 操作/删除 实体
* **推荐** 总是从数据库中获取所有的相关实体以对他们执行操作.
* **推荐** 更新实体后调用存储的Update/UpdateAsync方法.因为并非所有数据库API都支持更改跟踪和自动更新.
#### 使用其他应用服务
* **不推荐** 使用相同 **模块/应用程序** 的其他应用服务. 相反;
* 使用领域层执行所需的任务.
* 提取新类并在应用程序服务之间共享, 在必要时代码重用.
* 提取新类并在应用程序服务之间共享, 在必要时代码重用. 但要小心不要结合两个用例. 它们在开始时可能看起来相似, 但可能会随时间演变为不同的方向. 请谨慎使用代码共享.
* **可以** 在以下情况下使用其他应用服务;
* 它们是另一个模块/微服务的一部分.
* 当前模块仅引用已使用模块的application contracts.

54
docs/zh-Hans/Exception-Handling.md

@ -11,15 +11,15 @@ ABP提供了用于处理Web应用程序异常的标准模型.
当满足下面**任意一个条件**时,`AbpExceptionFilter` 会处理此异常:
* 当**controller action**方法返回类型是**object**(不是view)并有异常抛出时.
* 当一个请求为AJAX(Http请求头中`X-Requested-With`为`XMLHttpRequest`)时.
* 当**controller action**方法返回类型是**object result**(不是view result)并有异常抛出时.
* 当一个请求为AJAX(Http请求头中`X-Requested-With`为`XMLHttpRequest`)时.
* 当客户端接受的返回类型为`application/json`(Http请求头中`accept` 为`application/json`)时.
如果异常被处理过,则会自动**记录日志**并将格式化的**JSON消息**返回给客户端.
#### 异常消息格式
#### 错误消息格式
每个异常消息都是`RemoteServiceErrorResponse` 类的实例.下面是一个只有 **Message** 属性的错误JSON:
每个错误消息都是`RemoteServiceErrorResponse` 类的实例.最简单的错误JSON只有一个 **Message** 属性,如下所示:
````json
{
@ -29,11 +29,11 @@ ABP提供了用于处理Web应用程序异常的标准模型.
}
````
当异常发生时,会自动填充到这些**可选字段**.
其它**可选字段**可以根据已发生的异常来填充.
##### 错误代码
错误**Code** 是字符串类型,并要求唯一的可选属性.如果抛出的异常包含 **Code** 属性,那么应该实现`IHasErrorCode` 接口,来填充这个字段.示例JSON如下:
错误 **代码(code)** 是异常信息中一个有唯一值并可选的字符串值.抛出的异常应实现`IHasErrorCode` 接口来填充该字段.示例JSON如下:
````json
{
@ -44,11 +44,11 @@ ABP提供了用于处理Web应用程序异常的标准模型.
}
````
错误 **Code** 同样可用于异常的本地化及自定义HTTP状态代码(请参阅下面的相关部分).
错误代码同样可用于异常信息的本地化及自定义HTTP状态代码(请参阅下面的相关部分).
##### 错误详细信息
错误的 **Details** 是可选属性.抛出的异常应该实现`IHasErrorDetails` 接口来填充这个字段.示例JSON如下:
错误的 **详细信息(Details)** 是可选属性.抛出的异常应实现`IHasErrorDetails` 接口来填充该字段.示例JSON如下:
```json
{
@ -62,7 +62,7 @@ ABP提供了用于处理Web应用程序异常的标准模型.
##### 验证错误
当抛出的异常继承至`IHasValidationErrors` 接口时,返回错误对象会包含一个可选属性**validationErrors** .示例JSON如下:
当抛出的异常实现`IHasValidationErrors` 接口时,**validationErrors**是一个可被填充的标准字段.示例JSON如下:
````json
{
@ -85,7 +85,7 @@ ABP提供了用于处理Web应用程序异常的标准模型.
#### 日志
自动记录捕获异常的日志.
被捕获的异常会被自动记录到日志中.
##### 日志级别
@ -102,7 +102,7 @@ public class MyException : Exception, IHasLogLevel
##### 异常自定义日志
某些异常类型可能需要记录额外日志信息.可以通过实现`IExceptionWithSelfLogging` 来记录指定日志,例如:
某些异常类型可能需要记录额外日志信息.可以通过实现`IExceptionWithSelfLogging` 接口来记录指定日志,例如:
````C#
public class MyException : Exception, IExceptionWithSelfLogging
@ -114,7 +114,7 @@ public class MyException : Exception, IExceptionWithSelfLogging
}
````
> 扩展方法`ILogger.LogException` 用来记录日志. 在需要时可以使用相同的扩展方法.
> 扩展方法`ILogger.LogException` 用来记录异常日志. 在需要时可以使用相同的扩展方法.
### 业务异常
@ -140,9 +140,9 @@ throw new BusinessException(QaErrorCodes.CanNotVoteYourOwnAnswer);
Volo.Qa:010002
````
`Volo.Qa`在这是作为`code-namespace`. `code-namespace` 同样可以在异常 **本地化**使用.
`Volo.Qa`在这是作为`code-namespace`. `code-namespace` 同样可以在 **本地化** 异常信息时使用.
* 你可以直接抛出一个 `BusinessException` 异常或者自定义的异常.
* 你可以直接抛出一个 `BusinessException` 异常,或者需要时可以从该类派生你自己的Exception类型.
* 对于`BusinessException` 类型,其所有属性都是可选的.但是通常会设置`ErrorCode`或`Message`属性.
### 异常本地化
@ -153,7 +153,7 @@ Volo.Qa:010002
如果异常实现了 `IUserFriendlyException` 接口,那么ABP不会修改 `Message`和`Details`属性,而直接将它发送给客户端.
`UserFriendlyException`默认实现了 `IUserFriendlyException` 接口,示例如下:
`UserFriendlyException`是内建的 `IUserFriendlyException` 接口的实现,示例如下:
````C#
throw new UserFriendlyException(
@ -167,7 +167,7 @@ throw new UserFriendlyException(
throw new UserFriendlyException(_stringLocalizer["UserNameShouldBeUniqueMessage"]);
````
再在本地化资源的语言中添加对应的定义.例如:
再在本地化资源中为每种语言添加对应的定义.例如:
````json
{
@ -178,7 +178,7 @@ throw new UserFriendlyException(_stringLocalizer["UserNameShouldBeUniqueMessage"
}
````
**string localizer** 支持格式化参数.例如
**string localizer** 支持参数化信息.例如
````C#
throw new UserFriendlyException(_stringLocalizer["UserNameShouldBeUniqueMessage", "john"]);
@ -192,12 +192,12 @@ throw new UserFriendlyException(_stringLocalizer["UserNameShouldBeUniqueMessage"
* `IUserFriendlyException`接口派生自`IBusinessException`,而 `UserFriendlyException `类派生自`BusinessException`类.
#### 错误代码
#### 使用错误代码
`UserFriendlyException`很好用,但是在一些高级用法里面,它存在以下问题:
* 在抛出异常的地方必须注入**string localizer** 来实现本地化 .
* 但是,在某些情况下,**可能注入不了string localizer**(比如,静态方法或实体中)
* 但是,在某些情况下,**可能注入不了string localizer**(比如,在静态上下文或实体方法中)
那么这时就可以通过使用 **错误代码** 的方式来处理本地化,而不是在抛出异常的时候.
@ -210,7 +210,7 @@ services.Configure<ExceptionLocalizationOptions>(options =>
});
````
再使用本地化资源,来本地化`Volo.Qa`命名空间下的所有异常. 本地化资源中应包含对应错误代码的文本. 例如:
然后`Volo.Qa`命名空间下的所有异常都将被对应的本地化资源进行本地化处理. 本地化资源中应包含对应错误代码的文本. 例如:
````json
{
@ -227,12 +227,12 @@ services.Configure<ExceptionLocalizationOptions>(options =>
throw new BusinessException(QaDomainErrorCodes.CanNotVoteYourOwnAnswer);
````
* 所有实现`IHasErrorCode` 接口的异常都具有相同的行为.因此,对错误代码的本地化,并不是`BusinessException`类所特有的.
* 错误消息的本地化文本的并不是必须. 如果未定义,ABP会将默认的错误消息发送给客户端. 而并不是发送异常的`Message`属性. 如果你想要发送异常的`Message`,使用`UserFriendlyException`(或使用实现`IUserFriendlyException`接口的异常类型)
* 抛出所有实现`IHasErrorCode` 接口的异常都具有相同的行为.因此,对错误代码的本地化,并不是`BusinessException`类所特有的.
* 为错误消息定义本地化文本并不是必须的. 如果未定义,ABP会将默认的错误消息发送给客户端. 而不使用异常的`Message`属性. 如果你想要发送异常的`Message`,使用`UserFriendlyException`(或使用实现`IUserFriendlyException`接口的异常类型)
##### 使用消息的格式化参数
如果错误消息包含格式化参数时,则可以使用异常的`Data`属性进行设置.例如:
如果有参数化的错误消息,则可以使用异常的`Data`属性进行设置.例如:
````C#
throw new BusinessException("App:010046")
@ -263,9 +263,9 @@ throw new BusinessException("App:010046")
}
````
* `WithData` 支持链式调用 (如`.WithData(...).WithData(...)`).
* `WithData` 支持有多个参数的链式调用 (如`.WithData(...).WithData(...)`).
### HTTP状态代码 映射
### HTTP状态代码映射
ABP尝试按照以下规则,自动映射常见的异常类型的HTTP状态代码:
@ -297,6 +297,6 @@ services.Configure<ExceptionHttpStatusCodeOptions>(options =>
- 当用户没有权限执行操作时,会抛出 `AbpAuthorizationException` 异常. 有关更多信息,请参阅授权文档(TODO:link).
- 如果当前请求的输入无效,则抛出`AbpValidationException 异常`. 有关更多信息,请参阅授权文档(TODO:link).
- 如果请求的实体不存在,则抛出`EntityNotFoundException` 异常. 此异常由 [repositories](Repositories.md) 抛出.
- 如果请求的实体不存在,则抛出`EntityNotFoundException` 异常. 此异常大多数由 [repositories](Repositories.md) 抛出.
你同样可以在代码中抛出这些类型的异常(虽然只在很少时候)
你同样可以在代码中抛出这些类型的异常(虽然很少需要这样做)

66
docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md

@ -24,7 +24,7 @@
### 创建Book实体
**领域层** 定义[实体](../../Entities.md)(`Acme.BookStore.Domain` 中).这个项目最主要的实体就是`Book`:
**领域层** 定义[实体](../../Entities.md)(`Acme.BookStore.Domain` 项目中).这个项目最主要的实体就是`Book`:
````C#
using System;
@ -50,14 +50,14 @@ namespace Acme.BookStore
}
````
* ABP有两个基本的实体基类: `AggregateRoot``Entity`.**Aggregate Root**是 **领域驱动设计(DDD)** 的概念.查看[实体](../../Entities.md)的更多信息和最佳实践.
* `Book`实体继承了`AuditedAggregateRoot`,`AuditedAggregateRoot`类在`AggregateRoot`类的基础上添加了(`CreationTime`, `CreatorId`, `LastModificationTime`... 等.)审计属性.
* `Book`实体的主键类型是`Guid`类型.
* ABP有两个基本的实体基类: `AggregateRoot``Entity`.**Aggregate Root**是 **领域驱动设计(DDD)** 的概念之一.更多信息和最佳实践请查看[实体文档](../../Entities.md).
* `Book`实体继承了`AuditedAggregateRoot`,`AuditedAggregateRoot`类在`AggregateRoot`类的基础上添加了一些审计属性(`CreationTime`, `CreatorId`, `LastModificationTime`... 等.).
* `Guid`是`Book`实体的主键类型.
* 使用 **数据注解** 为EF Core添加映射.或者你也可以使用 EF Core 自带的[fluent mapping API](https://docs.microsoft.com/en-us/ef/core/modeling).
#### BookType枚举
下面是所有要用到的`BookType`枚举:
上面所用到的`BookType`枚举定义如下:
````C#
namespace Acme.BookStore
@ -79,19 +79,31 @@ namespace Acme.BookStore
#### 将Book实体添加到DbContext中
EF Core需要你将实体和DbContext建立关联.最简单的做法是在`Acme.BookStore.EntityFrameworkCore`项目的`BookStoreDbContext`类中添加`DbSet`属性.如:
EF Core需要你将实体和DbContext建立关联.最简单的做法是在`Acme.BookStore.EntityFrameworkCore`项目的`BookStoreDbContext`类中添加`DbSet`属性.如下所示:
````C#
public class BookStoreDbContext : AbpDbContext<BookStoreDbContext>
{
public DbSet<Book> Book { get; set; }
public DbSet<Book> Books { get; set; }
...
}
````
#### 配置你的Book实体
从`Acme.BookStore.EntityFrameworkCore` 项目中打开 BookStoreDbContextModelCreatingExtensions.cs 文件, 在 ConfigureBookStore 方法最后添加如下代码来配置Book实体:
````C#
builder.Entity<Book>(b =>
{
b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema);
b.ConfigureExtraProperties();
});
````
#### 添加新的Migration并更新数据库
这个启动模板使用了[EF Core Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/)来创建并维护数据库结构.打开 **Package Manager Console (PMC)** (工具/Nuget包管理器菜单),选择 `Acme.BookStore.EntityFrameworkCore.DbMigrations`作为默认的项目然后执行下面的命令:
这个启动模板使用了[EF Core Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/)来创建并维护数据库结构.打开 **程序包管理器控制台(Package Manager Console) (PMC)** (工具/Nuget包管理器菜单),选择 `Acme.BookStore.EntityFrameworkCore.DbMigrations`作为默认的项目然后执行下面的命令:
![bookstore-pmc-add-book-migration](images/bookstore-pmc-add-book-migration-v2.png)
@ -136,10 +148,10 @@ namespace Acme.BookStore
}
````
* **DTO**类被用来在 **基础设施层****应用层** **传递数据**.查看[DTO文档](../../Data-Transfer-Objects.md)查看更多信息.
* 为了在页面上展示书籍信息,`BookDto`被用来将书籍数据传递到基础设施层.
* **DTO**类被用来在 **表示层****应用层** **传递数据**.查看[DTO文档](../../Data-Transfer-Objects.md)查看更多信息.
* 为了在页面上展示书籍信息,`BookDto`被用来将书籍数据传递到表示层.
* `BookDto`继承自 `AuditedEntityDto<Guid>`.跟上面定义的`Book`类一样具有一些审计属性.
* `[AutoMapFrom(typeof(Book))]`用来创建从`Book`类到`BookDto`的映射.使用这种方法.你可以将`Book`对象自动转换成`BookDto`对象(而不是手动复制所有的属性).
* `[AutoMapFrom(typeof(Book))]`用来创建从`Book`类到`BookDto`的AutoMapper映射.使用这种方法.你可以将`Book`对象自动转换成`BookDto`对象(而不是手动复制所有的属性).
#### CreateUpdateBookDto
@ -171,7 +183,7 @@ namespace Acme.BookStore
}
````
* 这个DTO类在创建和更新书籍的时候被使用,用来从页面获取图书信息.
* 这个DTO类被用于在创建或更新书籍的时候从用户界面获取图书信息.
* 类中的属性定义了数据注解(如`[Required]`)用来定义有效性验证.ABP会自动校验DTO的数据有效性.
#### IBookAppService
@ -191,14 +203,14 @@ namespace Acme.BookStore
Guid, //Book实体的主键
PagedAndSortedResultRequestDto, //获取书籍的时候用于分页和排序
CreateUpdateBookDto, //用于创建书籍
CreateUpdateBookDto> //用更新书籍
CreateUpdateBookDto> //用更新书籍
{
}
}
````
* 为应用服务定义接口不是必须的,不过,我们推荐这么做.
* 为应用服务定义接口不是必须的,不过,这是推荐的最佳实践.
* `IAsyncCrudAppService`中定义了基础的 **CRUD**方法:`GetAsync`, `GetListAsync`, `CreateAsync`, `UpdateAsync``DeleteAsync`.不需要扩展它.取而代之,你可以继承空的`IApplicationService`接口定义你自己的方法.
* `IAsyncCrudAppService`有一些变体,你可以为每一个方法使用单个或者多个的DTO.(译者注:意思是类似EntityDto和UpdateEntityDto可以用同一个,也可以分别单独指定
)
@ -231,14 +243,14 @@ namespace Acme.BookStore
````
* `BookAppService`继承了`AsyncCrudAppService<...>`.`AsyncCrudAppService<...>`实现了上面定义的CRUD方法.
* `BookAppService`注入了`IRepository<Book, Guid>`,`IRepository<Book, Guid>`是默认为`Book`创建的仓储.ABP会自动为每一个聚合根(或实体)创建仓储.参考[仓储](../../Repositories.md).
* `BookAppService`使用了 `IObjectMapper` 将`Book`转换成`BookDto`,将`CreateUpdateBookDto`转换成`Book`.启动模板中使用了[AutoMapper](http://automapper.org/)作为映射工具.你可以像上面那样使用`AutoMapFrom` 和 `AutoMapTo`定义映射.查看[AutoMapper继承](../../AutoMapper-Integration.md)获取更多信息.
* `BookAppService`注入了`IRepository<Book, Guid>`,`IRepository<Book, Guid>`是默认为`Book`创建的仓储.ABP会自动为每一个聚合根(或实体)创建仓储.参考[仓储文档](../../Repositories.md).
* `BookAppService`使用了 `IObjectMapper` 将`Book`转换成`BookDto`,将`CreateUpdateBookDto`转换成`Book`.启动模板中使用了[AutoMapper](http://automapper.org/)作为对象映射提供程序.你可以像上面那样使用`AutoMapFrom` 和 `AutoMapTo`定义映射.查看[AutoMapper集成文档](../../AutoMapper-Integration.md)获取更多信息.
### 自动生成API Controllers
你通常需要创建 **Controllers** 将应用服务暴露为 **HTTP API**.这样浏览器或第三方客户端可以通过AJAX的方式访问它们.
ABP可以 **自动地** (../../AspNetCore/Auto-API-Controllers.md)将应用服务转换成MVC API Controllers.
ABP可以通过约定[**自动**](../../AspNetCore/Auto-API-Controllers.md)将应用服务转换成MVC API Controllers.
#### Swagger UI
@ -250,13 +262,13 @@ ABP可以 **自动地** (../../AspNetCore/Auto-API-Controllers.md)将应用服
### 动态JavaScript代理
通过AJAX的方式调用HTTP API接口是很常见的,你可以使用`$.ajax`或这其他的工具来调用接口.当然,ABP中提供了更好的方式.
在Javascript端通过AJAX的方式调用HTTP API接口是很常见的,你可以使用`$.ajax`或这其他的工具来调用接口.当然,ABP中提供了更好的方式.
ABP **自动** 为所有的API接口创建了JavaScript **代理**.因此,你可以像调用 **JavaScript function**一样调用任何接口.
#### 在浏览器的开发者控制台中测试接口
你可以使用你爱的浏览器的 **开发者控制台** 中轻松测试JavaScript代理.运行程序,并打开浏览器的 **开发者工具**(快捷键:F12),切换到 **Console**,输入下面的代码并回车:
你可以使用你爱的浏览器的 **开发者控制台** 中轻松测试JavaScript代理.运行程序,并打开浏览器的 **开发者工具**(快捷键:F12),切换到 **Console** 标签,输入下面的代码并回车:
````js
acme.bookStore.book.getList({}).done(function (result) { console.log(result); });
@ -265,14 +277,14 @@ acme.bookStore.book.getList({}).done(function (result) { console.log(result); })
* `acme.bookStore`是`BookAppService`的命名空间,转换成了[驼峰命名](https://en.wikipedia.org/wiki/Camel_case).
* `book`是`BookAppService`转换后的名字(去除了AppService后缀并转成了驼峰命名).
* `getList`是定义在`AsyncCrudAppService`基类中的`GetListAsync`方法转换后的名字(去除了Async后缀并转成了驼峰命名).
* `{}`参数用来传递一个空的对象给`GetListAsync`方法.GetListAsync期望的参数是`PagedAndSortedResultRequestDto`类型,`PagedAndSortedResultRequestDto`类型中定义了分页和排序.
* `{}`参数用来传递一个空的对象给`GetListAsync`方法.GetListAsync期望的参数是`PagedAndSortedResultRequestDto`类型的对象,`PagedAndSortedResultRequestDto`类型中定义了分页和排序选项.
* `getList`方法返回了一个`promise`.因此,你可以传递一个回调函数到`done`(或者`then`)方法中来获取服务返回的结果.
运行这段代码会产生下面的输出:
![bookstore-test-js-proxy-getlist](images/bookstore-test-js-proxy-getlist.png)
你可以看到服务器返回的 **book list**.你还可以切换到开发者工具的 **network** 查看客户端和服务器的连接:
你可以看到服务器返回的 **book list**.你还可以切换到开发者工具的 **network** 查看客户端到服务器端的通讯信息:
![bookstore-test-js-proxy-getlist-network](images/bookstore-test-js-proxy-getlist-network.png)
@ -292,10 +304,10 @@ successfully created the book with id: f3f03580-c1aa-d6a9-072d-39e75c69f5c7
### 创建书籍页面
现在我们来创建一些可见的可用的东西,我们使用[Razor Pages UI](https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start)代替经典的MVC.微软也推荐使用Razor Pages UI
现在我们来创建一些可见和可用的东西,取代经典的MVC,我们使用微软推荐的[Razor Pages UI](https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start).
`Acme.BookStore.Web`项目的`Pages`文件夹下创建一个新的文件夹叫`Books`并添加一个名`Index.cshtml`的Razor Page.
`Acme.BookStore.Web`项目的`Pages`文件夹下创建一个新的文件夹叫`Books`并添加一个名`Index.cshtml`的Razor Page.
![bookstore-add-index-page](images/bookstore-add-index-page.png)
@ -310,7 +322,7 @@ successfully created the book with id: f3f03580-c1aa-d6a9-072d-39e75c69f5c7
<h2>Books</h2>
````
* 改变Razor View Page Model默认的继承,使页面的 **inherits** 来自`BookStorePageBase`类(代替`PageModel`).`BookStorePageBase`类来自启动模板并提供了一些公开的属性/方法,这些属性/方法可以被所有的页面使用.
* 修改Razor View Page Model的默认继承,使页面 **继承** 自`BookStorePageBase`类(代替`PageModel`).`BookStorePageBase`类来自于启动模板,它提供了一些公开的可以被所有的页面使用的属性/方法.
#### 将Books页面添加到主菜单
@ -349,11 +361,11 @@ context.Menu.AddItem(
![bookstore-menu-items](images/bookstore-menu-items.png)
点击菜单就会调转到新增书籍的页面.
点击Books菜单项就会跳转到新增的书籍页面.
#### 书籍列表
我们会在页面上使用JQuery插件[Datatables.net](https://datatables.net/)来展示列表.Datatables可以完全通过AJAX工作,所以它很快而且有良好的用户体验.启动模板中已经配置好了Datatables,因此你可以在你的页面中直接使用,不需要引用样式和脚本文件.
我们会在页面上使用JQuery插件[Datatables.net](https://datatables.net/)来展示列表.Datatables可以完全通过AJAX工作,所以它很快而且有良好的用户体验.启动模板中已经配置好了Datatables插件,因此你可以在你的页面中直接使用,不需要引用样式和脚本文件.
##### 修改Index.cshtml
@ -388,7 +400,7 @@ context.Menu.AddItem(
</abp-card>
````
* `abp-script` [tag helper](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro)可以将添加外部的 **scripts**添加到页面中.它比标准的`script`标签多了很多额外的功能.它可以处理 **最小化**和 **版本**.查看[bundling & minification 文档](../../AspNetCore/Bundling-Minification.md)获取更多信息.
* `abp-script` [tag helper](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro)用于将外部的 **脚本** 添加到页面中.它比标准的`script`标签多了很多额外的功能.它可以处理 **最小化**和 **版本**.查看[捆绑 & 压缩文档](../../AspNetCore/Bundling-Minification.md)获取更多信息.
* `abp-card``abp-table` 是为Twitter Bootstrap的[card component](http://getbootstrap.com/docs/4.1/components/card/)封装的 **tag helpers**.ABP中有很多tag helpers,可以很方便的使用大多数[bootstrap](https://getbootstrap.com/)组件.你也可以使用原生的HTML标签代替tag helpers.使用tag helper可以通过智能提示和编译时类型检查减少HTML代码并防止错误.查看[tag helpers 文档](../../AspNetCore/Tag-Helpers.md).
* 你可以像上面本地化菜单一样 **本地化** 列名.

20
docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md

@ -53,9 +53,9 @@ namespace Acme.BookStore.Pages.Books
}
````
* 这个类继承了 `BookStorePageModelBase` 而非默认的 `PageModel`. `BookStorePageModelBase` 继承了 `PageModel` 并且添加了一些Razor页面模型通用的属性和方法.
* 该类在 `Book` 属性上标记`[BindProperty]` 特性绑定了post请求提交上来的数据.
* 该类通过构造函数注入了 `IBookAppService` 应用服务,并且在 `OnPostAsync` 方法中调用了服务的 `CreateAsync` 方法.
* 该类派生于 `BookStorePageModelBase` 而非默认的 `PageModel`. `BookStorePageModelBase` 继承了 `PageModel` 并且添加了一些可以被你的page model类使用的通用属性和方法.
* `Book` 属性上的 `[BindProperty]` 特性将post请求提交上来的数据绑定到该属性上.
* 该类通过构造函数注入了 `IBookAppService` 应用服务,并且在 `OnPostAsync` 处理程序中调用了服务的 `CreateAsync` 方法.
##### CreateModal.cshtml
@ -82,7 +82,7 @@ namespace Acme.BookStore.Pages.Books
* 这个 modal 使用 `abp-dynamic-form` Tag Helper 根据 `CreateBookViewModel` 类自动构建了表单.
* `abp-model` 指定了 `Book` 属性为模型对象.
* `data-ajaxForm` 设置了表单通过AJAX提交.
* `data-ajaxForm` 设置了表单通过AJAX提交,而不是经典的页面回发.
* `abp-form-content` tag helper 作为表单控件渲染位置的占位符 (这是可选的,只有你在 `abp-dynamic-form` 中像本示例这样添加了其他内容才需要).
#### 添加 "New book" 按钮
@ -211,7 +211,7 @@ namespace Acme.BookStore
}
````
* 仅仅是添加 `[AutoMapFrom(typeof(BookDto))]` 特性就可以创建上述映射关系.
* 仅添加 `[AutoMapFrom(typeof(BookDto))]` 特性就可以创建上述映射关系.
#### EditModal.cshtml
@ -238,9 +238,9 @@ namespace Acme.BookStore
</abp-dynamic-form>
````
除了以下几点,这个页面内容和 `CreateModal.cshtml` 非常相似:
这个页面内容和 `CreateModal.cshtml` 非常相似,除了以下几点:
* 此页面包含了一个 `abp-input` 以保存所编辑book实体的 `Id` 属性.
* 此页面包含了一个 `abp-input` 以保存所编辑book实体的 `Id` 属性.
* 此页面指定的post地址是 `Books/EditModal` ,并用文本 *Update* 作为 modal 标题.
#### 为表格添加 "操作(Actions)" 下拉菜单
@ -325,8 +325,8 @@ $(function () {
````
* 通过 `abp.localization.getResource('BookStore')` 可以在客户端使用服务器端定义的相同的本地化语言文本.
* 定义 `editModal` `ModalManager` 来打开编辑用的 modal 对话框.
* 在 `columnDefs` 起始处新增一列作为 "Actions" 下拉按钮.
* 添加了一个名为 `editModal` 的新的 `ModalManager` 来打开编辑用的 modal 对话框.
* 在 `columnDefs` 起始处新增一列用于显示 "Actions" 下拉按钮.
* "Edit" 操作只是简单调用 `editModal.open` 来打开编辑对话框.
现在,你可以运行程序,通过编辑操作来更新任一个book实体.
@ -354,7 +354,7 @@ $(function () {
* `confirmMessage` 用来在实际执行 `action` 之前向用户进行确认.
* 通过javascript代理方法 `acme.bookStore.book.delete` 执行一个AJAX请求来删除一个book实体.
* `abp.notify.info` 用来提示用户操作成功.
* `abp.notify.info` 用来在执行删除操作后显示一个toastr通知信息.
最终的 `index.js` 文件内容如下所示:

2
docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md

@ -58,7 +58,7 @@ namespace Acme.BookStore
}
````
* 这里直接使用了identity模块实现的 `IIdentityDataSeeder` 接口,创建了一个admin角色和admin用户.你同样可以在你的测试代码中直接使用这些代码.
* 这里直接使用了identity模块实现的 `IIdentityDataSeeder` 接口,创建了一个admin角色和admin用户.你可以在测试代码中使用它们.
* 你可以在 `BuildInternalAsync` 方法中添加你自己的测试数据.
按下方所示修改 `BookStoreTestDataBuilder` 类:

41
framework/Volo.Abp.sln

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}"
EndProject
@ -215,6 +215,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Features", "src\Vo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Features.Tests", "test\Volo.Abp.Features.Tests\Volo.Abp.Features.Tests.csproj", "{575BEFA1-19C2-49B1-8D31-B5D4472328DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp", "src\Volo.Abp\Volo.Abp.csproj", "{6C161F55-54B6-42A5-B177-3B0ED50323C1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Authentication.JwtBearer", "src\Volo.Abp.AspNetCore.Authentication.JwtBearer\Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj", "{46C6336C-A1D8-4858-98CE-6F4C698C5A77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Cli", "src\Volo.Abp.Cli\Volo.Abp.Cli.csproj", "{69168816-4394-4DDA-BB6B-C21983D37F0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.FluentValidation", "src\Volo.Abp.FluentValidation\Volo.Abp.FluentValidation.csproj", "{43D5FE61-ECBF-4B16-AD95-0043E18EB93A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.FluentValidation.Tests", "test\Volo.Abp.FluentValidation.Tests\Volo.Abp.FluentValidation.Tests.csproj", "{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -637,6 +647,26 @@ Global
{575BEFA1-19C2-49B1-8D31-B5D4472328DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{575BEFA1-19C2-49B1-8D31-B5D4472328DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{575BEFA1-19C2-49B1-8D31-B5D4472328DE}.Release|Any CPU.Build.0 = Release|Any CPU
{6C161F55-54B6-42A5-B177-3B0ED50323C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C161F55-54B6-42A5-B177-3B0ED50323C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C161F55-54B6-42A5-B177-3B0ED50323C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C161F55-54B6-42A5-B177-3B0ED50323C1}.Release|Any CPU.Build.0 = Release|Any CPU
{46C6336C-A1D8-4858-98CE-6F4C698C5A77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46C6336C-A1D8-4858-98CE-6F4C698C5A77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46C6336C-A1D8-4858-98CE-6F4C698C5A77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46C6336C-A1D8-4858-98CE-6F4C698C5A77}.Release|Any CPU.Build.0 = Release|Any CPU
{43D5FE61-ECBF-4B16-AD95-0043E18EB93A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43D5FE61-ECBF-4B16-AD95-0043E18EB93A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43D5FE61-ECBF-4B16-AD95-0043E18EB93A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43D5FE61-ECBF-4B16-AD95-0043E18EB93A}.Release|Any CPU.Build.0 = Release|Any CPU
{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A}.Release|Any CPU.Build.0 = Release|Any CPU
{69168816-4394-4DDA-BB6B-C21983D37F0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69168816-4394-4DDA-BB6B-C21983D37F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69168816-4394-4DDA-BB6B-C21983D37F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69168816-4394-4DDA-BB6B-C21983D37F0B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -746,6 +776,11 @@ Global
{88F6D091-CA16-4B71-9499-8D5B8FA2E712} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{01E3D389-8872-4EB1-9D3D-13B6ED54DE0E} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{575BEFA1-19C2-49B1-8D31-B5D4472328DE} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{6C161F55-54B6-42A5-B177-3B0ED50323C1} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{46C6336C-A1D8-4858-98CE-6F4C698C5A77} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{43D5FE61-ECBF-4B16-AD95-0043E18EB93A} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{E9E1714F-7ED2-4BD1-BA4A-BA06E398288A} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{69168816-4394-4DDA-BB6B-C21983D37F0B} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

25
framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs

@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
namespace Microsoft.AspNetCore.Builder
{
public static class ApplicationBuilderAbpJwtTokenMiddlewareExtension
{
public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder app, string schema = JwtBearerDefaults.AuthenticationScheme)
{
return app.Use(async (ctx, next) =>
{
if (ctx.User.Identity?.IsAuthenticated != true)
{
var result = await ctx.AuthenticateAsync(schema);
if (result.Succeeded && result.Principal != null)
{
ctx.User = result.Principal;
}
}
await next();
});
}
}
}

24
framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Authentication.JwtBearer</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Authentication.JwtBearer</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
</ItemGroup>
</Project>

11
framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs

@ -0,0 +1,11 @@
using Volo.Abp.Modularity;
using Volo.Abp.Security;
namespace Volo.Abp.AspNetCore.Authentication.JwtBearer
{
[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationJwtBearerModule : AbpModule
{
}
}

3
framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
@ -14,7 +14,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
</ItemGroup>

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs

@ -17,13 +17,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers
where TTagHelper : TagHelper
{
protected const string FormGroupContents = "FormGroupContents";
protected const string NavItemContents = "FormGroupContents";
protected const string TabItems = "TabItems";
protected const string AccordionItems = "AccordionItems";
protected const string BreadcrumbItemsContent = "BreadcrumbItemsContent";
protected const string CarouselItemsContent = "CarouselItemsContent";
protected const string TabItemsDataTogglePlaceHolder = "{_data_toggle_Placeholder_}";
protected const string TabItemsVerticalPillPlaceHolder = "{_vertical_pill_Placeholder_}";
protected const string TabItemNamePlaceHolder = "{_Tab_Tag_Name_Placeholder_}";
protected const string AbpFormContentPlaceHolder = "{_AbpFormContentPlaceHolder_}";
protected const string AbpTabItemActivePlaceholder = "{_Tab_Active_Placeholder_}";
@ -31,9 +29,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers
protected const string AbpTabItemShowActivePlaceholder = "{_Tab_Show_Active_Placeholder_}";
protected const string AbpBreadcrumbItemActivePlaceholder = "{_Breadcrumb_Active_Placeholder_}";
protected const string AbpCarouselItemActivePlaceholder = "{_CarouselItem_Active_Placeholder_}";
protected const string AbpNavItemActivePlaceholder = "{_NavItem_Active_Placeholder_}";
protected const string AbpNavItemResponsiveFlexPlaceholder = "{_NavItem_Responsive_Flex_Placeholder_}";
protected const string AbpNavItemResponsiveAlignPlaceholder = "{_NavItem_Responsive_Align_Placeholder_}";
protected const string AbpTabItemSelectedPlaceholder = "{_Tab_Selected_Placeholder_}";
protected const string AbpAccordionParentIdPlaceholder = "{_Parent_Accordion_Id_}";

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -124,8 +124,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return GetLabelAsHtmlUsingTagHelper(context, output) + GetRequiredSymbol(context, output);
}
protected virtual string GetRequiredSymbol(TagHelperContext context, TagHelperOutput output)
{
if (!TagHelper.DisplayRequiredSymbol)

12
framework/src/Volo.Abp.Cli/Program.cs

@ -0,0 +1,12 @@
using System;
namespace Volo.Abp.Cli
{
public class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Welcome to ABP CLI..! This tool is in development. There is no functionality yet. So, bye bye... ;)");
}
}
}

12
framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>abp</ToolCommandName>
</PropertyGroup>
</Project>

24
framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.FluentValidation</AssemblyName>
<PackageId>Volo.Abp.FluentValidation</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="8.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Validation\Volo.Abp.Validation.csproj" />
</ItemGroup>
</Project>

46
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs

@ -0,0 +1,46 @@
using System;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.FluentValidation
{
public class AbpFluentValidationConventionalRegistrar : DefaultConventionalRegistrar
{
public override void AddType(IServiceCollection services, Type type)
{
if (!typeof(IValidator).IsAssignableFrom(type))
{
return;
}
var validatingType = GetFirstGenericArgumentOrNull(type, 1);
if (validatingType == null)
{
return;
}
services.AddTransient(
typeof(IValidator<>).MakeGenericType(validatingType),
type
);
}
private static Type GetFirstGenericArgumentOrNull(Type type, int depth)
{
const int maxFindDepth = 8;
if (depth >= maxFindDepth)
{
return null;
}
if (type.IsGenericType && type.GetGenericArguments().Length >= 1)
{
return type.GetGenericArguments()[0];
}
return GetFirstGenericArgumentOrNull(type.BaseType, depth + 1);
}
}
}

25
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationModule.cs

@ -0,0 +1,25 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Validation;
namespace Volo.Abp.FluentValidation
{
[DependsOn(
typeof(AbpValidationModule)
)]
public class AbpFluentValidationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddConventionalRegistrar(new AbpFluentValidationConventionalRegistrar());
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpValidationOptions>(options =>
{
options.MethodValidationContributors.Add<FluentMethodInvocationValidator>();
});
}
}
}

55
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentMethodInvocationValidator.cs

@ -0,0 +1,55 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using FluentValidation;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Validation;
namespace Volo.Abp.FluentValidation
{
public class FluentMethodInvocationValidator : IMethodInvocationValidator, ITransientDependency
{
private readonly IServiceProvider _serviceProvider;
public FluentMethodInvocationValidator(
IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public void Validate(MethodInvocationValidationContext context)
{
var validationResult = new AbpValidationResult();
foreach (var parameterValue in context.ParameterValues)
{
var serviceType = typeof(IValidator<>).MakeGenericType(parameterValue.GetType());
var validator = _serviceProvider.GetService(serviceType) as IValidator;
if (validator == null)
{
continue;
}
var result = validator.Validate(parameterValue);
if (!result.IsValid)
{
validationResult.Errors.AddRange(
result.Errors.Select(
error =>
new ValidationResult(error.ErrorMessage)
)
);
}
}
if (validationResult.Errors.Any())
{
//TODO: How to localize messages?
throw new AbpValidationException(
"Method arguments are not valid! See ValidationErrors for details.",
context.Errors
);
}
}
}
}

6
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs

@ -225,7 +225,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying
}
//TODO: Is that the way we want? Couldn't send the culture (not ui culture)
requestMessage.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(CultureInfo.CurrentUICulture.Name));
var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
if (!currentCulture.IsNullOrEmpty())
{
requestMessage.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(currentCulture));
}
}
private string GetConfiguredApiVersion()

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/pt-BR.json

@ -45,6 +45,7 @@
"PagerShowMenuEntries": "Mostrando _MENU_ registros",
"DatatableActionDropdownDefaultText": "Ações",
"ChangePassword": "Alterar Senha",
"PersonalInfo": "Perfil"
"PersonalInfo": "Perfil",
"AreYouSureYouWantToCancelEditingWarningMessage": "Você tem alterações não salvas."
}
}

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json

@ -45,6 +45,7 @@
"PagerShowMenuEntries": "显示 _MENU_ 实体",
"DatatableActionDropdownDefaultText": "操作",
"ChangePassword": "修改密码",
"PersonalInfo": "个人信息"
"PersonalInfo": "个人信息",
"AreYouSureYouWantToCancelEditingWarningMessage": "你有未保存的更改."
}
}

8
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationModule.cs

@ -9,5 +9,13 @@ namespace Volo.Abp.Validation
{
context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpValidationOptions>(options =>
{
options.MethodValidationContributors.Add<MethodInvocationValidator>();
});
}
}
}

4
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/IValidationConfiguration.cs → framework/src/Volo.Abp.Validation/Volo/Abp/Validation/AbpValidationOptions.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Collections;
namespace Volo.Abp.Validation
{
@ -7,9 +8,12 @@ namespace Volo.Abp.Validation
{
public List<Type> IgnoredTypes { get; }
public ITypeList<IMethodInvocationValidator> MethodValidationContributors { get; set; }
public AbpValidationOptions()
{
IgnoredTypes = new List<Type>();
MethodValidationContributors = new TypeList<IMethodInvocationValidator>();
}
}
}

4
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/IMethodInvocationValidator.cs

@ -1,7 +1,7 @@
namespace Volo.Abp.Validation
namespace Volo.Abp.Validation
{
public interface IMethodInvocationValidator
{
void Validate(MethodInvocationValidationContext context);
}
}
}

32
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs

@ -1,4 +1,7 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.Aspects;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
@ -7,11 +10,13 @@ namespace Volo.Abp.Validation
{
public class ValidationInterceptor : AbpInterceptor, ITransientDependency
{
private readonly IMethodInvocationValidator _validator;
private readonly AbpValidationOptions _abpValidationOptions;
private readonly IServiceProvider _serviceProvider;
public ValidationInterceptor(IMethodInvocationValidator validator)
public ValidationInterceptor(IServiceProvider serviceProvider, IOptions<AbpValidationOptions> abpValidationOptions)
{
_validator = validator;
_serviceProvider = serviceProvider;
_abpValidationOptions = abpValidationOptions.Value;
}
public override void Intercept(IAbpMethodInvocation invocation)
@ -42,13 +47,18 @@ namespace Volo.Abp.Validation
protected virtual void Validate(IAbpMethodInvocation invocation)
{
_validator.Validate(
new MethodInvocationValidationContext(
invocation.TargetObject,
invocation.Method,
invocation.Arguments
)
);
foreach (var validationContributor in _abpValidationOptions.MethodValidationContributors)
{
var validator = (IMethodInvocationValidator) _serviceProvider.GetRequiredService(validationContributor);
validator.Validate(
new MethodInvocationValidationContext(
invocation.TargetObject,
invocation.Method,
invocation.Arguments
)
);
}
}
}
}

3
framework/src/Volo.Abp/README.md

@ -0,0 +1,3 @@
# Volo.Abp
This package is a name holder. It just references to the `Volo.Abp.Core` package.

19
framework/src/Volo.Abp/Volo.Abp.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp</AssemblyName>
<PackageId>Volo.Abp</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Core\Volo.Abp.Core.csproj" />
</ItemGroup>
</Project>

21
framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Volo.Abp.FluentValidation.Tests</AssemblyName>
<PackageId>Volo.Abp.FluentValidation.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.FluentValidation\Volo.Abp.FluentValidation.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
</ItemGroup>
</Project>

206
framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs

@ -0,0 +1,206 @@
using System.Threading.Tasks;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Autofac;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Validation;
using Xunit;
namespace Volo.Abp.FluentValidation
{
public class ApplicationService_FluentValidation_Tests : AbpIntegratedTest<ApplicationService_FluentValidation_Tests.TestModule>
{
private readonly IMyAppService _myAppService;
public ApplicationService_FluentValidation_Tests()
{
_myAppService = ServiceProvider.GetRequiredService<IMyAppService>();
}
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
{
options.UseAutofac();
}
[Fact]
public async Task Should_Work_Proper_With_Right_Inputs()
{
// MyStringValue should be aaa, MyStringValue2 should be bbb. MyStringValue3 should be ccc
var output = _myAppService.MyMethod(new MyMethodInput
{
MyStringValue = "aaa",
MyMethodInput2 = new MyMethodInput2
{
MyStringValue2 = "bbb"
},
MyMethodInput3 = new MyMethodInput3
{
MyStringValue3 = "ccc"
}
});
output.ShouldBe("aaabbbccc");
var asyncOutput = await _myAppService.MyMethodAsync(new MyMethodInput
{
MyStringValue = "aaa",
MyMethodInput2 = new MyMethodInput2
{
MyStringValue2 = "bbb"
},
MyMethodInput3 = new MyMethodInput3
{
MyStringValue3 = "ccc"
}
});
asyncOutput.ShouldBe("aaabbbccc");
}
[Fact]
public async Task Should_Not_Work_With_Wrong_Inputs()
{
// MyStringValue should be aaa, MyStringValue2 should be bbb. MyStringValue3 should be ccc
Assert.Throws<AbpValidationException>(() => _myAppService.MyMethod(new MyMethodInput
{
MyStringValue = "a",
MyMethodInput2 = new MyMethodInput2
{
MyStringValue2 = "b"
},
MyMethodInput3 = new MyMethodInput3
{
MyStringValue3 = "c"
}
}));
await Assert.ThrowsAsync<AbpValidationException>(async () => await _myAppService.MyMethodAsync(
new MyMethodInput
{
MyStringValue = "a",
MyMethodInput2 = new MyMethodInput2
{
MyStringValue2 = "b"
},
MyMethodInput3 = new MyMethodInput3
{
MyStringValue3 = "c"
}
}));
}
[Fact]
public void NotValidateMyMethod_Test()
{
var output = _myAppService.NotValidateMyMethod(new MyMethodInput4
{
MyStringValue4 = "444"
});
output.ShouldBe("444");
}
[DependsOn(typeof(AbpAutofacModule))]
[DependsOn(typeof(AbpFluentValidationModule))]
public class TestModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(onServiceRegistredContext =>
{
if (typeof(IMyAppService).IsAssignableFrom(onServiceRegistredContext.ImplementationType))
{
onServiceRegistredContext.Interceptors.TryAdd<ValidationInterceptor>();
}
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddType<MyAppService>();
}
}
public interface IMyAppService
{
string MyMethod(MyMethodInput input);
Task<string> MyMethodAsync(MyMethodInput input);
string NotValidateMyMethod(MyMethodInput4 input);
}
public class MyAppService : IMyAppService, ITransientDependency
{
public string MyMethod(MyMethodInput input)
{
return input.MyStringValue + input.MyMethodInput2.MyStringValue2 + input.MyMethodInput3.MyStringValue3;
}
public Task<string> MyMethodAsync(MyMethodInput input)
{
return Task.FromResult(input.MyStringValue + input.MyMethodInput2.MyStringValue2 +
input.MyMethodInput3.MyStringValue3);
}
public string NotValidateMyMethod(MyMethodInput4 input)
{
return input.MyStringValue4;
}
}
public class MyMethodInput
{
public string MyStringValue { get; set; }
public MyMethodInput2 MyMethodInput2 { get; set; }
public MyMethodInput3 MyMethodInput3 { get; set; }
}
public class MyMethodInput2
{
public string MyStringValue2 { get; set; }
}
public class MyMethodInput3
{
public string MyStringValue3 { get; set; }
}
public class MyMethodInput4
{
public string MyStringValue4 { get; set; }
}
public class MyMethodInputValidator : AbstractValidator<MyMethodInput>
{
public MyMethodInputValidator()
{
RuleFor(x => x.MyStringValue).Equal("aaa");
RuleFor(x => x.MyMethodInput2.MyStringValue2).Equal("bbb");
RuleFor(customer => customer.MyMethodInput3).SetValidator(new MyMethodInput3Validator());
}
}
public class MethodInputBaseValidator : AbstractValidator<MyMethodInput3>
{
public MethodInputBaseValidator()
{
RuleFor(x => x.MyStringValue3).NotNull();
}
}
public class MyMethodInput3Validator : MethodInputBaseValidator
{
public MyMethodInput3Validator()
{
RuleFor(x => x.MyStringValue3).Equal("ccc");
}
}
}
}

31
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml

@ -23,35 +23,6 @@
}
<div class="vs-blog">
@*<div class="vs-blog-header">
<div class="vs-blog-title">
<div class="row">
<div class="col">
<h1 class="my-0 display-inline-block">
@Model.Blog.Name
<small class="text-muted">
@if (string.IsNullOrWhiteSpace(Model.TagName))
{
@L["BLOG"]
}
else
{
@Html.Raw("#")@Model.TagName
}
</small>
</h1>
</div>
<div class="col-sm-4 text-right">
<br />
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Posts.Create))
{
<a asp-page="./New" asp-route-blogShortName="@Model.BlogShortName">@L["CreateANewPost"]</a>
<span class="vs-seperator">|</span>
}
</div>
</div>
</div>
</div>*@
<div class="pb-3">
<div class="row">
<div class="col-md-8">
@ -76,7 +47,7 @@
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName">@post.Title</a>
</h2>
<p class="article-sum">
@Html.Raw(GetShortContent(post.Content)))
@Html.Raw(GetShortContent(post.Content))
</p>
<a asp-page="./Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName" class="btn btn-primary btn-rounded">@L["ContinueReading"]</a>

4
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.css

@ -0,0 +1,4 @@
.vs-blog .hero-section .hero-article-img {
min-height: 480px;
background: center center no-repeat;
background-size: cover; }

1
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.min.css

@ -0,0 +1 @@
.vs-blog .hero-section .hero-article-img{min-height:480px;background:center center no-repeat;background-size:cover;}

10
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.scss

@ -0,0 +1,10 @@
.vs-blog {
.hero-section {
.hero-article-img {
min-height: 480px;
background: center center no-repeat;
background-size: cover;
}
}
}

8
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.css

@ -43,7 +43,7 @@
display: inline-block;
border-radius: 50%; }
.hero-section .hero-articles .img-container {
background: black; }
min-height: 320px; }
.hero-section .hero-articles .img-container img {
filter: grayscale(10%); }
.hero-section .hero-articles .img-container::after {
@ -54,7 +54,7 @@
bottom: 0px;
width: 100%;
top: 1% !important;
background: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.91) 89%, rgba(0, 0, 0, 0.93) 93%) !important;
background: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.75) 89%, rgba(0, 0, 0, 0.78) 93%) !important;
transition: .2s all ease-in-out;
opacity: .9; }
.hero-section .hero-articles:hover .img-container::after {
@ -136,5 +136,5 @@
.img-container {
position: relative;
overflow: hidden;
border-radius: 4px; }
border-radius: 4px;
background: gainsboro; }

2
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.min.css

@ -1 +1 @@
.hero-section{padding:0;}.hero-section .hero-articles{position:relative;overflow:hidden;}.hero-section .hero-articles .hero-content{position:absolute;left:12%;right:12%;bottom:80px;z-index:4;text-align:center;}.hero-section .hero-articles .hero-content h2{margin-top:0;font-size:2.5em;font-weight:bold;}.hero-section .hero-articles .hero-content a{color:#fff;text-shadow:0 0 20px rgba(0,0,0,.5);}.hero-section .hero-articles .hero-content p{color:#fff;}.hero-section .hero-articles .tags .tag{background:rgba(208,208,208,.3);color:#fff !important;}.hero-section .hero-articles .tags .tag:hover{background:#fff;color:#000 !important;}.hero-section .hero-articles .article-owner{text-align:center;position:relative;z-index:12;}.hero-section .hero-articles .article-owner .article-infos{color:#000;}.hero-section .hero-articles .article-owner .article-infos a{color:#000;}.hero-section .hero-articles .article-owner .article-infos .seperator{margin:0 4px;color:rgba(255,255,255,.2);}.hero-section .hero-articles .article-owner .article-infos img.article-avatar{width:64px;margin:-25px 10px 0 0;border:3px solid #fff;display:inline-block;border-radius:50%;}.hero-section .hero-articles .img-container{background:#000;}.hero-section .hero-articles .img-container img{filter:grayscale(10%);}.hero-section .hero-articles .img-container::after{content:"";display:block;position:absolute;z-index:1;bottom:0;width:100%;top:1% !important;background:linear-gradient(to bottom,transparent 0,rgba(0,0,0,.91) 89%,rgba(0,0,0,.93) 93%) !important;transition:.2s all ease-in-out;opacity:.9;}.hero-section .hero-articles:hover .img-container::after{opacity:1;}.article-owner .article-infos{color:#000;}.article-owner .article-infos a{color:rgba(0,0,0,.6);}.article-owner .article-infos .seperator{margin:0 4px;color:rgba(0,0,0,.2);}.article-owner .article-infos img.article-avatar{width:30px;margin:-1px 4px 0 0;display:inline-block;border-radius:50%;}.card-articles .card-content{padding:10px 0 10px;}.card-articles .card-content h3{margin:10px 0;}.card-articles .card-content h3 a{font-weight:700;}.card-articles .article-owner{text-align:left;}.card-articles .article-owner .article-infos{color:#000;}.card-articles .article-owner .article-infos a{color:rgba(0,0,0,.6);}.card-articles .article-owner .article-infos .seperator{margin:0 4px;color:rgba(0,0,0,.2);}.card-articles .article-owner .article-infos img.article-avatar{width:30px;margin:-1px 4px 0 0;display:inline-block;border-radius:50%;}.article-owner{font-size:.85em;}.user-link-icons{position:absolute;right:18px;top:15px;z-index:3;}.user-link-icons a{display:inline-block;color:#eee;margin-left:12px;font-size:1.25em;}.user-link-icons a:hover{color:#fff;}.tags .tag{display:inline-block;padding:2px 8px;background:rgba(208,208,208,.3);border-radius:30px;margin:0 1px 3px 0;color:#b1b1b1 !important;font-size:.7em;line-height:1.6em;text-transform:uppercase;}.tags .tag:hover{background:#000;color:#fff !important;}.popular-tags a{display:block;font-size:.9em;}.popular-tags a span{float:right;opacity:.3;font-size:.9em;}.img-container{position:relative;overflow:hidden;border-radius:4px;}
.hero-section{padding:0;}.hero-section .hero-articles{position:relative;overflow:hidden;}.hero-section .hero-articles .hero-content{position:absolute;left:12%;right:12%;bottom:80px;z-index:4;text-align:center;}.hero-section .hero-articles .hero-content h2{margin-top:0;font-size:2.5em;font-weight:bold;}.hero-section .hero-articles .hero-content a{color:#fff;text-shadow:0 0 20px rgba(0,0,0,.5);}.hero-section .hero-articles .hero-content p{color:#fff;}.hero-section .hero-articles .tags .tag{background:rgba(208,208,208,.3);color:#fff !important;}.hero-section .hero-articles .tags .tag:hover{background:#fff;color:#000 !important;}.hero-section .hero-articles .article-owner{text-align:center;position:relative;z-index:12;}.hero-section .hero-articles .article-owner .article-infos{color:#000;}.hero-section .hero-articles .article-owner .article-infos a{color:#000;}.hero-section .hero-articles .article-owner .article-infos .seperator{margin:0 4px;color:rgba(255,255,255,.2);}.hero-section .hero-articles .article-owner .article-infos img.article-avatar{width:64px;margin:-25px 10px 0 0;border:3px solid #fff;display:inline-block;border-radius:50%;}.hero-section .hero-articles .img-container{min-height:320px;}.hero-section .hero-articles .img-container img{filter:grayscale(10%);}.hero-section .hero-articles .img-container::after{content:"";display:block;position:absolute;z-index:1;bottom:0;width:100%;top:1% !important;background:linear-gradient(to bottom,transparent 0,rgba(0,0,0,.75) 89%,rgba(0,0,0,.78) 93%) !important;transition:.2s all ease-in-out;opacity:.9;}.hero-section .hero-articles:hover .img-container::after{opacity:1;}.article-owner .article-infos{color:#000;}.article-owner .article-infos a{color:rgba(0,0,0,.6);}.article-owner .article-infos .seperator{margin:0 4px;color:rgba(0,0,0,.2);}.article-owner .article-infos img.article-avatar{width:30px;margin:-1px 4px 0 0;display:inline-block;border-radius:50%;}.card-articles .card-content{padding:10px 0 10px;}.card-articles .card-content h3{margin:10px 0;}.card-articles .card-content h3 a{font-weight:700;}.card-articles .article-owner{text-align:left;}.card-articles .article-owner .article-infos{color:#000;}.card-articles .article-owner .article-infos a{color:rgba(0,0,0,.6);}.card-articles .article-owner .article-infos .seperator{margin:0 4px;color:rgba(0,0,0,.2);}.card-articles .article-owner .article-infos img.article-avatar{width:30px;margin:-1px 4px 0 0;display:inline-block;border-radius:50%;}.article-owner{font-size:.85em;}.user-link-icons{position:absolute;right:18px;top:15px;z-index:3;}.user-link-icons a{display:inline-block;color:#eee;margin-left:12px;font-size:1.25em;}.user-link-icons a:hover{color:#fff;}.tags .tag{display:inline-block;padding:2px 8px;background:rgba(208,208,208,.3);border-radius:30px;margin:0 1px 3px 0;color:#b1b1b1 !important;font-size:.7em;line-height:1.6em;text-transform:uppercase;}.tags .tag:hover{background:#000;color:#fff !important;}.popular-tags a{display:block;font-size:.9em;}.popular-tags a span{float:right;opacity:.3;font-size:.9em;}.img-container{position:relative;overflow:hidden;border-radius:4px;background:#dcdcdc;}

92
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.scss

@ -1,66 +1,80 @@
.hero-section {
padding: 0;
.hero-articles {
position: relative;
overflow: hidden;
.hero-content {
.hero-section {
padding: 0;
.hero-articles {
position: relative;
overflow: hidden;
.hero-content {
position: absolute;
left: 12%;
right: 12%;
bottom: 80px;
z-index: 4;
z-index: 4;
text-align: center;
h2 {
margin-top: 0;
font-size: 2.5em;
font-weight: bold;
}
a {
a {
color: white;
text-shadow: 0px 0px 20px rgba(0, 0, 0, 0.5);
}
p {
p {
color: white;
}
}
}
.tags {
.tag {
background: rgba(208, 208, 208, 0.3);
color: #fff !important;
&:hover {
background: white;
.tags {
.tag {
background: rgba(208, 208, 208, 0.3);
color: #fff !important;
&:hover {
background: white;
color: black !important;
}
}
}
.article-owner {
text-align: center;
position: relative;
.article-owner {
text-align: center;
position: relative;
z-index: 12;
.article-infos {
color: black;
color: black;
a {
color: black;
color: black;
}
.seperator {
margin: 0 4px;
color: rgba(255, 255, 255, 0.2);
}
img.article-avatar {
img.article-avatar {
width: 64px;
margin: -25px 10px 0px 0;
margin: -25px 10px 0px 0;
border: 3px solid #fff;
display: inline-block;
border-radius: 50%;
border-radius: 50%;
}
}
}
.img-container {
background: black;
}
.img-container {
min-height: 320px;
img {
filter: grayscale(10%);
}
filter: grayscale(10%);
}
&::after {
content: "";
display: block;
@ -69,19 +83,20 @@
bottom: 0px;
width: 100%;
top: 1% !important;
background: linear-gradient(to bottom,rgba(0, 0, 0, 0) 0,rgba(0, 0, 0, 0.91) 89%,rgba(0, 0, 0, 0.93) 93%) !important;
background: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.75) 89%, rgba(0, 0, 0, 0.78) 93%) !important;
transition: .2s all ease-in-out;
opacity: .9;
}
}
&:hover {
}
&:hover {
.img-container {
&::after {
&::after {
opacity: 1;
}
}
}
}
}
}
}
.article-owner {
@ -189,8 +204,9 @@
.img-container {
position: relative;
position: relative;
overflow: hidden;
border-radius: 4px;
border-radius: 4px;
background: gainsboro;
}

8
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css

@ -132,7 +132,7 @@
display: inline-block;
border-radius: 50%; }
div.vs-blog .hero-section .hero-articles .img-container {
background: black; }
min-height: 320px; }
div.vs-blog .hero-section .hero-articles .img-container img {
filter: grayscale(10%); }
div.vs-blog .hero-section .hero-articles .img-container::after {
@ -143,7 +143,7 @@
bottom: 0px;
width: 100%;
top: 1% !important;
background: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.91) 89%, rgba(0, 0, 0, 0.93) 93%) !important;
background: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.75) 89%, rgba(0, 0, 0, 0.78) 93%) !important;
transition: .2s all ease-in-out;
opacity: .9; }
div.vs-blog .hero-section .hero-articles:hover .img-container::after {
@ -217,7 +217,8 @@
div.vs-blog .img-container {
position: relative;
overflow: hidden;
border-radius: 4px; }
border-radius: 4px;
background: gainsboro; }
div.vs-blog .post-detail h1 {
padding: 0px 0;
line-height: 1.25em;
@ -309,4 +310,3 @@
div.vs-blog .box-articles .img-container img.portrait {
width: 100%;
height: auto; } }

2
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.min.css

File diff suppressed because one or more lines are too long

4
modules/blogging/src/Volo.Blogging.Web/compilerconfig.json

@ -6,5 +6,9 @@
{
"outputFile": "Pages/Blog/Shared/Styles/_home.css",
"inputFile": "Pages/Blog/Shared/Styles/_home.scss"
},
{
"outputFile": "Pages/Blog/Posts/Index.css",
"inputFile": "Pages/Blog/Posts/Index.scss"
}
]

10
modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Posts/Post_Tests.cs

@ -13,7 +13,7 @@ namespace Volo.Blogging
[Fact]
public void IncreaseReadCount()
{
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
post.IncreaseReadCount();
post.ReadCount.ShouldBe(1);
}
@ -23,7 +23,7 @@ namespace Volo.Blogging
[InlineData("bbb")]
public void SetTitle(string title)
{
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
post.SetTitle(title);
post.Title.ShouldBe(title);
}
@ -33,7 +33,7 @@ namespace Volo.Blogging
[InlineData("bbb")]
public void SetUrl(string url)
{
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
post.SetUrl(url);
post.Url.ShouldBe(url);
}
@ -41,7 +41,7 @@ namespace Volo.Blogging
[Fact]
public void AddTag()
{
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var tagId = Guid.NewGuid();
post.AddTag(tagId);
post.Tags.ShouldContain(x => x.TagId == tagId);
@ -51,7 +51,7 @@ namespace Volo.Blogging
[Fact]
public void RemoveTag()
{
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var post = new Post(Guid.NewGuid(), Guid.NewGuid(), "abp", "⊙o⊙", "abp.io");
var tagId = Guid.NewGuid();
post.AddTag(tagId);

2
modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj

@ -1,5 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

10
modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj

@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<IsPackable>true</IsPackable>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.ClientSimulation.Web</AssemblyName>
<PackageId>Volo.ClientSimulation.Web</PackageId>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<RootNamespace>Volo.ClientSimulation</RootNamespace>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
</PropertyGroup>
<ItemGroup>

8
modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj

@ -1,8 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace></RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.ClientSimulation</AssemblyName>
<PackageId>Volo.ClientSimulation</PackageId>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

6
modules/docs/README.md

@ -1,4 +1,4 @@
# docs module
# Docs Module
This module is used to create technical documentation web sites. [abp.io](https://abp.io) web site uses this module for its documentation.
### Screenshot
@ -7,7 +7,7 @@ This module is used to create technical documentation web sites. [abp.io](https:
### Main Features
* Can read documents from a Github repository.
* Retrieves documents from a Github repository.
* Supports Markdown document formatting.
* Supports versioning (integrated to Github releases).
* Support multiple projects.
* Supports multiple projects.

35
modules/docs/Volo.Docs.sln

@ -23,10 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Web", "src\Volo.D
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{555508AD-F593-43E3-9354-9FA51512F181}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.DocsTestApp", "app\Volo.DocsTestApp\Volo.DocsTestApp.csproj", "{30BC20A3-85CE-4907-8FD0-54153C3F190C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.DocsTestApp.EntityFrameworkCore", "app\Volo.DocsTestApp.EntityFrameworkCore\Volo.DocsTestApp.EntityFrameworkCore.csproj", "{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "domain", "domain", "{A982A58E-1E92-4764-9F56-39E7AABB8556}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin-app", "admin-app", "{BCA19441-17E9-43E6-AED1-15344D18F967}"
@ -55,6 +51,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.TestBase", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.Application.Tests", "test\Volo.Docs.Admin.Application.Tests\Volo.Docs.Admin.Application.Tests.csproj", "{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.EntityFrameworkCore", "app\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj", "{1B459653-8DAC-41CD-A08E-28D6E74265D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.Web", "app\VoloDocs.Web\VoloDocs.Web.csproj", "{057EA924-4524-4452-840C-5E3D509F2ED3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoloDocs.Migrator", "app\VoloDocs.Migrator\VoloDocs.Migrator.csproj", "{8A5E5001-C017-44A8-ADDA-DC66C102556E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -93,14 +95,6 @@ Global
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Release|Any CPU.Build.0 = Release|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Release|Any CPU.Build.0 = Release|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Release|Any CPU.Build.0 = Release|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -141,6 +135,18 @@ Global
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Release|Any CPU.Build.0 = Release|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Release|Any CPU.Build.0 = Release|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Release|Any CPU.Build.0 = Release|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -154,8 +160,6 @@ Global
{30808C64-F590-47F7-AF8A-256F6B6E186B} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{BF3FDDFF-BED8-422C-82E9-07F181A2D47F} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{871FB966-C89F-4AF5-BB1D-172625AA571C} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{30BC20A3-85CE-4907-8FD0-54153C3F190C} = {555508AD-F593-43E3-9354-9FA51512F181}
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A} = {555508AD-F593-43E3-9354-9FA51512F181}
{A982A58E-1E92-4764-9F56-39E7AABB8556} = {42416152-5BAB-4706-93A6-57A19E71FE14}
{BCA19441-17E9-43E6-AED1-15344D18F967} = {42416152-5BAB-4706-93A6-57A19E71FE14}
{8B0CDFC9-E313-4323-9390-59CFFAAC60B5} = {42416152-5BAB-4706-93A6-57A19E71FE14}
@ -169,6 +173,9 @@ Global
{89F895EA-C4A0-4D91-9181-016F78459776} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{C8BF652A-6DDF-4E5C-8CBA-BA5AFC50BFE2} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{1B459653-8DAC-41CD-A08E-28D6E74265D3} = {555508AD-F593-43E3-9354-9FA51512F181}
{057EA924-4524-4452-840C-5E3D509F2ED3} = {555508AD-F593-43E3-9354-9FA51512F181}
{8A5E5001-C017-44A8-ADDA-DC66C102556E} = {555508AD-F593-43E3-9354-9FA51512F181}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {13691265-2547-4FFF-B757-E8FACB05679D}

4
modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml

@ -1,4 +0,0 @@
@page
@model Volo.DocsTestApp.Pages.IndexModel
<h3>Welcome to the Docs Demo!</h3>
<a href="/documents/">Go to documents...</a>

16
modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml.cs

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Volo.DocsTestApp.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
}

6
modules/docs/app/Volo.DocsTestApp/appsettings.json

@ -1,6 +0,0 @@
{
"ConnectionStrings": {
"SqlServer": "Server=localhost;Database=DocsTestApp;Trusted_Connection=True;MultipleActiveResultSets=true",
"MongoDb": "mongodb://localhost:27017|DocsTestApp"
}
}

6
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.DocsTestApp.EntityFrameworkCore;
using VoloDocs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
[DbContext(typeof(DocsTestAppDbContext))]
[DbContext(typeof(VoloDocsDbContext))]
[Migration("20181225134002_Initial20181225")]
partial class Initial20181225
{

2
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs

@ -1,7 +1,7 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
public partial class Initial20181225 : Migration
{

8
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/DocsTestAppDbContextModelSnapshot.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs

@ -4,12 +4,12 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.DocsTestApp.EntityFrameworkCore;
using VoloDocs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
[DbContext(typeof(DocsTestAppDbContext))]
partial class DocsTestAppDbContextModelSnapshot : ModelSnapshot
[DbContext(typeof(VoloDocsDbContext))]
partial class VoloDocsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{

1
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Volo.DocsTestApp.EntityFrameworkCore.csproj → modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>

6
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContext.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsDbContext.cs

@ -5,11 +5,11 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Docs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
public class DocsTestAppDbContext : AbpDbContext<DocsTestAppDbContext>
public class VoloDocsDbContext : AbpDbContext<VoloDocsDbContext>
{
public DocsTestAppDbContext(DbContextOptions<DocsTestAppDbContext> options)
public VoloDocsDbContext(DbContextOptions<VoloDocsDbContext> options)
: base(options)
{

14
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContextFactory.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsDbContextFactory.cs

@ -3,24 +3,24 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
public class DocsTestAppDbContextFactory : IDesignTimeDbContextFactory<DocsTestAppDbContext>
public class VoloDocsDbContextFactory : IDesignTimeDbContextFactory<VoloDocsDbContext>
{
public DocsTestAppDbContext CreateDbContext(string[] args)
public VoloDocsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<DocsTestAppDbContext>()
.UseSqlServer(configuration.GetConnectionString("SqlServer"));
var builder = new DbContextOptionsBuilder<VoloDocsDbContext>()
.UseSqlServer(configuration["ConnectionString"]);
return new DocsTestAppDbContext(builder.Options);
return new VoloDocsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Volo.DocsTestApp/"))
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../VoloDocs/"))
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();

4
modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppEntityFrameworkCoreModule.cs → modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocsEntityFrameworkCoreModule.cs

@ -5,7 +5,7 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Docs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
[DependsOn(
typeof(DocsEntityFrameworkCoreModule),
@ -13,7 +13,7 @@ namespace Volo.DocsTestApp.EntityFrameworkCore
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule))]
public class DocsTestAppEntityFrameworkCoreModule : AbpModule
public class VoloDocsEntityFrameworkCoreModule : AbpModule
{
}

13
modules/docs/app/VoloDocs.Migrator/AppExtensions.cs

@ -0,0 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
namespace VoloDocs.Migrator
{
public static class AppExtensions
{
public static T Resolve<T>(this IAbpApplicationWithInternalServiceProvider app)
{
return (T)app.ServiceProvider.GetRequiredService<T>();
}
}
}

1
modules/docs/app/VoloDocs.Migrator/Migrate.bat

@ -0,0 +1 @@
@dotnet VoloDocs.Migrator.dll

94
modules/docs/app/VoloDocs.Migrator/Program.cs

@ -0,0 +1,94 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using VoloDocs.EntityFrameworkCore;
namespace VoloDocs.Migrator
{
class Program
{
private const string ScriptFile = "Script.txt";
static void Main(string[] args)
{
Console.WriteLine("Initializing VoloDocs Migrator ... ");
using (var app = AbpApplicationFactory.Create<VoloDocsMigratorModule>())
{
app.Initialize();
using (var dbContext = app.Resolve<VoloDocsDbContext>())
{
var connectionString = dbContext.Database.GetDbConnection().ConnectionString;
Console.Clear();
if (args != null && args.Contains("-script"))
{
GenerateMigrationScript(dbContext);
return;
}
RunMigrations(connectionString, dbContext);
}
Console.WriteLine("\n\nPress ENTER to exit...");
Console.ReadLine();
}
}
private static void RunMigrations(string connectionString, VoloDocsDbContext dbContext)
{
Console.Write("\nThis program updates an existing database or creates a new one if not exists.\n" +
"The following connection string will be used:\n\n" +
connectionString + "\n\n" +
"Are you sure you want to run the migration? (y/n) ");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
Console.WriteLine("\n\nMigrating database...");
try
{
dbContext.Database.Migrate();
Console.WriteLine("Migration completed.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
while (ex.InnerException != null)
{
ex = ex.InnerException;
Console.WriteLine(ex.Message);
}
Console.Write("\nThere was problem while applying migrations. " +
"Do you want to create the migration script? (y/n) ");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
GenerateMigrationScript(dbContext);
}
}
}
}
private static void GenerateMigrationScript(VoloDocsDbContext dbContext)
{
if (File.Exists(ScriptFile))
{
File.Delete(ScriptFile);
}
Console.Write("\nGenerating migration scripts...");
File.WriteAllText(ScriptFile, dbContext.Database.GenerateCreateScript());
Console.Write("\nMigration script has been created to Script.txt file");
}
}
}

27
modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<ProjectReference Include="..\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="Migrate.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

29
modules/docs/app/VoloDocs.Migrator/VoloDocsMigratorModule.cs

@ -0,0 +1,29 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
using VoloDocs.EntityFrameworkCore;
namespace VoloDocs.Migrator
{
[DependsOn(typeof(VoloDocsEntityFrameworkCoreModule))]
public class VoloDocsMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAbpDbContext<VoloDocsDbContext>();
Configure<DbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = configuration["ConnectionString"];
});
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
});
}
}
}

3
modules/docs/app/VoloDocs.Migrator/appsettings.json

@ -0,0 +1,3 @@
{
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true"
}

29
modules/docs/app/VoloDocs.Web/Branding/VoloDocsBrandingProvider.cs

@ -0,0 +1,29 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components;
using Volo.Abp.Configuration;
using Volo.Abp.DependencyInjection;
namespace VoloDocs.Web.Branding
{
[Dependency(ReplaceServices = true)]
public class VoloDocsBrandingProvider : DefaultBrandingProvider
{
public VoloDocsBrandingProvider(IConfigurationAccessor configurationAccessor)
{
var configuration = configurationAccessor.Configuration;
if (configuration["Title"] != null)
{
AppName = configuration["Title"];
}
if (configuration["LogoUrl"] != null)
{
LogoUrl = configuration["LogoUrl"];
}
}
public override string AppName { get; }
public override string LogoUrl { get; }
}
}

2
modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs → modules/docs/app/VoloDocs.Web/Controllers/HomeController.cs

@ -1,6 +1,6 @@
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.DocsTestApp.Controllers
namespace VoloDocs.Web.Controllers
{
public class HomeController : AbpController
{

9
modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/en.json

@ -0,0 +1,9 @@
{
"culture": "en",
"texts": {
"WelcomeVoloDocs": "Welcome to the VoloDocs!",
"NoProjectWarning": "There`s no defined project yet!",
"CreateYourFirstProject": "Click here to start your first project",
"NoProject": "No project!"
}
}

9
modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/tr.json

@ -0,0 +1,9 @@
{
"culture": "tr",
"texts": {
"WelcomeVoloDocs": "VoloDocs Hoşgeldiniz!",
"NoProjectWarning": "Henüz bir proje yok!",
"CreateYourFirstProject": "İlk projenizi oluşturmak için tıklayın",
"NoProject": "Proje yok!"
}
}

14
modules/docs/app/VoloDocs.Web/Pages/Error.cshtml

@ -0,0 +1,14 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@model VoloDocs.Web.Pages.ErrorModel
@inject IHtmlLocalizer<DocsResource> L
@{
<div class="text-center">
<pre>
@Model.ErrorMessage
</pre>
<a href="/" class="btn btn-outline-primary">@L["BackToWebsite"]</a>
</div>
}

64
modules/docs/app/Volo.DocsTestApp/Controllers/ErrorController.cs → modules/docs/app/VoloDocs.Web/Pages/Error.cshtml.cs

@ -1,43 +1,52 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using Volo.Abp.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.DocsTestApp.Controllers
namespace VoloDocs.Web.Pages
{
public class ErrorController : AbpController
public class ErrorModel : AbpPageModel
{
[Route("error/{statusCode}")]
[HttpGet]
public IActionResult Index(int statusCode = 0)
public string ErrorMessage { get; set; }
public ActionResult OnGet(string statusCode)
{
var statusFeature = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
if (statusFeature != null)
try
{
Log.Warning("Handled {0} error for URL: {1}", statusCode, statusFeature.OriginalPath);
}
if (!int.TryParse(statusCode, out var errorStatusCode))
{
errorStatusCode = (int)HttpStatusCode.BadRequest;
}
var statusFeature = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
if (statusFeature != null)
{
Logger.LogWarning("Handled {0} error for URL: {1}", statusCode, statusFeature.OriginalPath);
}
var isValidStatusCode = Enum.IsDefined(typeof(HttpStatusCode), errorStatusCode);
if (!isValidStatusCode)
{
errorStatusCode = (int)HttpStatusCode.BadRequest;
}
var isValidStatusCode = Enum.IsDefined(typeof(HttpStatusCode), statusCode);
if (!isValidStatusCode)
ErrorMessage = _errorMessages.ContainsKey(errorStatusCode)
? _errorMessages[errorStatusCode]
: "Looks like something went wrong!";
}
catch (Exception e)
{
statusCode = (int)HttpStatusCode.BadRequest;
Logger.LogError("Error on error page: " + e);
}
return new ContentResult
{
ContentType = System.Net.Mime.MediaTypeNames.Text.Html,
StatusCode = statusCode,
Content = string.Format(HtmlBody, _errorMessages.ContainsKey(statusCode)
? _errorMessages[statusCode]
: "Looks like something went wrong!")
};
return Page();
}
private const string HtmlBody = "<html><body><div style='text-align:center'><pre>{0}</pre><a href='/'>Go to home page</a></div></body></html>";
#region Error Messages
/*For more ASCII arts http://patorjk.com/software/taag/#p=display&h=0&f=Big&t=400*/
private readonly Dictionary<int, string> _errorMessages = new Dictionary<int, string>
{
@ -84,7 +93,7 @@ This is a forbidden area!"
| | | |_| | | |
|_| \___/ |_|
We can't find the page you're looking for..."
Hmm, we couldn't find the page you're looking for..."
},
{
500,
@ -123,5 +132,6 @@ Ooops! Our server is experiencing a mild case of the hiccups."
Looks like we're having some server issues."
}
};
#endregion
}
}
}

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

@ -0,0 +1,56 @@
@page
@using System.Linq
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs
@using Volo.Docs.Localization
@using Volo.Docs.Pages.Documents
@model VoloDocs.Web.Pages.IndexModel
@inject IHtmlLocalizer<DocsResource> L
@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>
}
<div class="p-5">
<h1 class="text-center mb-5">
@L["WelcomeVoloDocs"]
</h1>
@if (!Model.Projects.Any())
{
<div class="d-flex justify-content-center">
<div class="alert alert-secondary col-md-6 text-center" role="alert">
<p>@L["NoProjectWarning"]</p>
<hr />
<a href="/Docs/Admin/Projects">@L["CreateYourFirstProject"] <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
}
else if (Model.Projects.Count > 1)
{
<h2>@L["Projects"]</h2>
<p>
<ul style="list-style-type: upper-roman;">
@foreach (var project in Model.Projects)
{
<li>
<h3>
<a asp-page="./Project/Index"
asp-route-projectName="@project.ShortName"
asp-route-version="@DocsAppConsts.Latest">
@project.Name
</a>
</h3>
</li>
}
</ul>
</p>
}
</div>

38
modules/docs/app/VoloDocs.Web/Pages/Index.cshtml.cs

@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Docs;
using Volo.Docs.Projects;
namespace VoloDocs.Web.Pages
{
public class IndexModel : PageModel
{
public IReadOnlyList<ProjectDto> Projects { get; set; }
private readonly IProjectAppService _projectAppService;
public IndexModel(IProjectAppService projectAppService)
{
_projectAppService = projectAppService;
}
public async Task<IActionResult> OnGet()
{
Projects = (await _projectAppService.GetListAsync()).Items;
if (Projects.Count == 1)
{
return RedirectToPage("./Documents/Project/Index", new
{
projectName = Projects[0].ShortName,
version = DocsAppConsts.Latest,
documentName = Projects[0].DefaultDocumentName
});
}
return Page();
}
}
}

0
modules/docs/app/Volo.DocsTestApp/Pages/_ViewImports.cshtml → modules/docs/app/VoloDocs.Web/Pages/_ViewImports.cshtml

2
modules/docs/app/Volo.DocsTestApp/Program.cs → modules/docs/app/VoloDocs.Web/Program.cs

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Hosting;
using Serilog;
using Serilog.Events;
namespace Volo.DocsTestApp
namespace VoloDocs.Web
{
public class Program
{

2
modules/docs/app/Volo.DocsTestApp/Properties/launchSettings.json → modules/docs/app/VoloDocs.Web/Properties/launchSettings.json

@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.DocsTestApp": {
"VoloDocs": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {

4
modules/docs/app/Volo.DocsTestApp/Startup.cs → modules/docs/app/VoloDocs.Web/Startup.cs

@ -5,13 +5,13 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp;
namespace Volo.DocsTestApp
namespace VoloDocs.Web
{
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddApplication<DocsTestAppModule>(options =>
services.AddApplication<VoloDocsWebModule>(options =>
{
options.UseAutofac();
});

45
modules/docs/app/VoloDocs.Web/Utils/GlobalExceptionHandlerMiddleware.cs

@ -0,0 +1,45 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Uow;
using Volo.Abp.Domain.Entities;
using Volo.Docs;
namespace VoloDocs.Web.Utils
{
public class GlobalExceptionHandlerMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger<AbpUnitOfWorkMiddleware> _logger;
public GlobalExceptionHandlerMiddleware(RequestDelegate next, ILogger<AbpUnitOfWorkMiddleware> logger)
{
_logger = logger;
_next = next;
}
public async Task Invoke(HttpContext httpContext)
{
try
{
await _next(httpContext);
}
catch (Exception ex)
{
_logger.LogError("Handled a global exception: " + ex.Message, ex);
if (ex.Message.StartsWith("404 error") ||
ex is EntityNotFoundException ||
ex is DocumentNotFoundException)
{
httpContext.Response.Redirect("/error/404");
}
else
{
httpContext.Response.Redirect("/error/500");
}
}
}
}
}

20
modules/docs/app/Volo.DocsTestApp/Volo.DocsTestApp.csproj → modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj

@ -2,11 +2,15 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<None Remove="Logs\**" />
<EmbeddedResource Include="Localization\Resources\VoloDocs\Web\en.json" />
<EmbeddedResource Include="Localization\Resources\VoloDocs\Web\tr.json" />
</ItemGroup>
<ItemGroup>
@ -23,12 +27,20 @@
<ProjectReference Include="..\..\src\Volo.Docs.Admin.Web\Volo.Docs.Admin.Web.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />
<ProjectReference Include="..\Volo.DocsTestApp.EntityFrameworkCore\Volo.DocsTestApp.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Logs\" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\assets\images\Logo.png" />
</ItemGroup>
</Project>

73
modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs → modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs

@ -1,16 +1,12 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
@ -21,6 +17,8 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.Identity;
@ -29,16 +27,18 @@ using Volo.Abp.UI;
using Volo.Abp.VirtualFileSystem;
using Volo.Docs;
using Volo.Docs.Admin;
using Volo.DocsTestApp.EntityFrameworkCore;
using Volo.Docs.Localization;
using VoloDocs.EntityFrameworkCore;
using VoloDocs.Web.Utils;
namespace Volo.DocsTestApp
namespace VoloDocs.Web
{
[DependsOn(
typeof(DocsWebModule),
typeof(DocsAdminWebModule),
typeof(DocsApplicationModule),
typeof(DocsAdminApplicationModule),
typeof(DocsTestAppEntityFrameworkCoreModule),
typeof(VoloDocsEntityFrameworkCoreModule),
typeof(AbpAutofacModule),
typeof(AbpAccountWebModule),
typeof(AbpIdentityWebModule),
@ -47,8 +47,16 @@ namespace Volo.DocsTestApp
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
)]
public class DocsTestAppModule : AbpModule
public class VoloDocsWebModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(typeof(DocsResource), typeof(VoloDocsWebModule).Assembly);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
@ -56,8 +64,7 @@ namespace Volo.DocsTestApp
Configure<DbConnectionOptions>(options =>
{
const string connStringName = "SqlServer";
options.ConnectionStrings.Default = configuration.GetConnectionString(connStringName);
options.ConnectionStrings.Default = configuration["ConnectionString"];
});
Configure<AbpDbContextOptions>(options =>
@ -83,30 +90,49 @@ namespace Volo.DocsTestApp
context.Services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new Info { Title = "Docs API", Version = "v1" });
options.SwaggerDoc("v1", new Info
{
Title = "Docs API",
Version = "v1"
});
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
var cultures = new List<CultureInfo> { new CultureInfo("en"), new CultureInfo("tr") };
Configure<RequestLocalizationOptions>(options =>
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<VoloDocsWebModule>("VoloDocs.Web");
});
Configure<AbpLocalizationOptions>(options =>
{
options.DefaultRequestCulture = new RequestCulture("en");
options.SupportedCultures = cultures;
options.SupportedUICultures = cultures;
options
.Languages
.Add(new LanguageInfo("en", "en", "English"));
options.Resources
.Get<DocsResource>()
.AddBaseTypes(typeof(AbpValidationResource))
.AddBaseTypes(typeof(AbpUiModule))
.AddVirtualJson("/Localization/Resources/VoloDocs/Web");
});
Configure<ThemingOptions>(options =>
{
options.DefaultThemeName = BasicTheme.Name;
});
Configure<RazorPagesOptions>(options =>
{
options.Conventions.AddPageRoute("/Error", "error/{statusCode}");
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseDeveloperExceptionPage();
var env = context.GetEnvironment();
app.UseVirtualFiles();
@ -118,9 +144,10 @@ namespace Volo.DocsTestApp
app.UseAuthentication();
app.UseRequestLocalization(app.ApplicationServices.GetRequiredService<IOptions<RequestLocalizationOptions>>().Value);
app.UseAbpRequestLocalization();
app.UseStatusCodePagesWithReExecute("/error/{0}");
//app.UseMiddleware<GlobalExceptionHandlerMiddleware>();
app.UseMvc(routes =>
{

0
modules/docs/app/Volo.DocsTestApp/abp.resourcemapping.js → modules/docs/app/VoloDocs.Web/abp.resourcemapping.js

5
modules/docs/app/VoloDocs.Web/appsettings.json

@ -0,0 +1,5 @@
{
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true",
"Title": "VoloDocs",
"LogoUrl": "/assets/images/Logo.png"
}

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

Loading…
Cancel
Save