From c3ab51f36e8702818dd81802dc46f525a19ddefc Mon Sep 17 00:00:00 2001 From: Savorboard Date: Mon, 11 Feb 2019 18:08:41 +0800 Subject: [PATCH] update docs --- docs/about.md | 5 --- docs/user-guide-cn/api-interface.md | 8 ++-- docs/user-guide/api-interface.md | 16 +++---- docs/user-guide/configuration.md | 2 +- docs/user-guide/faq.md | 2 +- docs/user-guide/getting-started.md | 2 +- mkdocs.yml | 69 ++++++++++++++++++++++++++--- 7 files changed, 78 insertions(+), 26 deletions(-) delete mode 100644 docs/about.md diff --git a/docs/about.md b/docs/about.md deleted file mode 100644 index a2c63e4..0000000 --- a/docs/about.md +++ /dev/null @@ -1,5 +0,0 @@ - -## Contact Us - -* Submit an issue -* Email: yangxiaodong1214@126.com \ No newline at end of file diff --git a/docs/user-guide-cn/api-interface.md b/docs/user-guide-cn/api-interface.md index cab722d..a81d839 100644 --- a/docs/user-guide-cn/api-interface.md +++ b/docs/user-guide-cn/api-interface.md @@ -4,7 +4,7 @@ CAP 的 API 接口只有一个,就是 `ICapPublisher` 接口,你可以从 DI 你可以使用 `ICapPublisher` 接口中的 `Publish` 或者 `PublishAsync` 方法来发送消息: -```cs +```c# public class PublishController : Controller { private readonly ICapPublisher _capBus; @@ -109,7 +109,7 @@ public DateTime ShowPublishTimeAndReturnExecuteTime(DateTime time) * EntityFramework -```cs +```c# using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false) { //业务代码 @@ -128,7 +128,7 @@ using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: fals * Dapper -```cs +```c# using (var connection = new MySqlConnection(ConnectionString)) { using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) @@ -201,7 +201,7 @@ public void BarAndFooMessageProcessor() 以下是使用组进行订阅的示例: -```cs +```c# [CapSubscribe("xxx.services.foo", Group = "moduleA")] public void FooMessageProcessor() { diff --git a/docs/user-guide/api-interface.md b/docs/user-guide/api-interface.md index acc9096..3cdb94c 100644 --- a/docs/user-guide/api-interface.md +++ b/docs/user-guide/api-interface.md @@ -6,7 +6,7 @@ CAP only has one interface,It is `ICapPublisher`, You can get its instance from You can use the `Publish` or `PublishAsync` methods defined in the `ICapPublisher` interface to send the event messages. -```cs +```c# public class PublishController : Controller { private readonly ICapPublisher _capBus; @@ -48,7 +48,7 @@ public class PublishController : Controller ``` The following is the signature of the of the PublishAsync method -```cs +```c# PublishAsync(string name, T object) ``` @@ -58,7 +58,7 @@ and then write messages into the `Cap.Published` message table. In some situations,you may need a callback when a message is sent out, you can use the follwing overload of the `PublishAsync` method: -```cs +```c# PublishAsync(string name, T object, string callBackName) ``` @@ -80,7 +80,7 @@ The following two blocks of code snippet demonstrate how to use transactions in #### EntityFramework -```cs +```c# using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false) { // Your business logic。 @@ -99,7 +99,7 @@ During the course,the message content will be serialized as json and stored in t #### Dapper -```cs +```c# using (var connection = new MySqlConnection(ConnectionString)) { using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) @@ -123,7 +123,7 @@ using (var connection = new MySqlConnection(ConnectionString)) Use `CapSubscribe[""]` to decorate a method so that it can subscribe messages published by CAP. -```cs +```c# [CapSubscribe("xxx.services.bar")] public void BarMessageProcessor() { @@ -131,7 +131,7 @@ public void BarMessageProcessor() ``` You can also use multiple `CapSubscribe[""]` to decorate a method so that you can subscribe messages from different sources accordingly. -```cs +```c# [CapSubscribe("xxx.services.bar")] [CapSubscribe("xxx.services.foo")] public void BarAndFooMessageProcessor() @@ -162,7 +162,7 @@ If you do not specify any group when subscribing,CAP will put the subscriber int the following is a demo shows how to use group when subscribing. -```cs +```c# [CapSubscribe("xxx.services.foo", Group = "moduleA")] public void FooMessageProcessor() { diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index 18a74a5..920e5eb 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -140,7 +140,7 @@ Note that if you are using EntityFramewrok, you do not use this configuration it CAP uses PostgreSql configuration functions for CapOptions extensions, so the configuration usage for PostgreSql is as follows: -```cs +```c# services.AddCap(capOptions => { capOptions.UsePostgreSql(postgreOptions => { // postgreOptions.ConnectionString diff --git a/docs/user-guide/faq.md b/docs/user-guide/faq.md index b77ba5d..897b34b 100644 --- a/docs/user-guide/faq.md +++ b/docs/user-guide/faq.md @@ -16,7 +16,7 @@ defining a prefix name of table in `ConfigureServices` method。 codes exsample: -```cs +```c# public void ConfigureServices(IServiceCollection services) { services.AddCap(x => diff --git a/docs/user-guide/getting-started.md b/docs/user-guide/getting-started.md index 53d3e2b..3915296 100644 --- a/docs/user-guide/getting-started.md +++ b/docs/user-guide/getting-started.md @@ -59,7 +59,7 @@ PM> Install-Package DotNetCore.CAP.MongoDB In an ASP.NET Core program, you can configure the services used by the CAP in the `Startup.cs` file `ConfigureServices()`: -```cs +```c# public void ConfigureServices(IServiceCollection services) { //...... diff --git a/mkdocs.yml b/mkdocs.yml index 9caf76f..34a15ff 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,17 @@ +# Project information site_name: CAP +site_url: https://cap.dotnet-chain.org +site_description: Project documentation with Markdown. +site_author: CAP Team +repo_name: 'dotnetcore/CAP' +repo_url: 'https://github.com/dotnetcore/cap' + +# Copyright +copyright: Copyright © 2017 .NET Core Community, Maintained by the CAP Team. + nav: - Home: index.md - - User Guide: + - User Guide: - Getting Started: user-guide/getting-started.md - API Interface: user-guide/api-interface.md - Configuration: user-guide/configuration.md @@ -9,7 +19,7 @@ nav: - Implementation Mechanisms: user-guide/implementation-mechanisms.md - Distributed Transactions: user-guide/distributed-transactions.md - FAQ: user-guide/faq.md - - 使用指南: + - 使用指南: - 快速开始: user-guide-cn/getting-started.md - API 接口: user-guide-cn/api-interface.md - 配置: user-guide-cn/configuration.md @@ -17,8 +27,55 @@ nav: - 实现: user-guide-cn/implementation-mechanisms.md - 分布式事务: user-guide-cn/distributed-transactions.md - FAQ: user-guide-cn/faq.md - - About: about.md -theme: cinder + - About: + - Release Notes: about/release-notes.md + - Contributing: about/contributing.md + - Contact Us: about/contact-us.md + +#theme: material +theme: + name: 'material' + palette: + primary: 'purple' + accent: 'indigo' + logo: + icon: 'cloud' + language: 'en' + #favicon: 'assets/images/favicon.ico' + feature: + tabs: true +#Search +extra: + search: + language: 'en, zh' + +# Extensions markdown_extensions: - - admonition -repo_url: "https://github.com/dotnetcore/CAP" \ No newline at end of file + - markdown.extensions.admonition + - markdown.extensions.codehilite: + guess_lang: true + - markdown.extensions.def_list + - markdown.extensions.footnotes + - markdown.extensions.meta + - markdown.extensions.toc: + permalink: true + - pymdownx.arithmatex + - pymdownx.betterem: + smart_enable: all + - pymdownx.caret + - pymdownx.critic + - pymdownx.details + - pymdownx.emoji: + emoji_generator: !!python/name:pymdownx.emoji.to_svg + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.magiclink: + repo_url_shorthand: true + user: dotnetcore + repo: cap + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.superfences + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde \ No newline at end of file