Browse Source

update docs

master
Savorboard 6 years ago
parent
commit
c3ab51f36e
7 changed files with 78 additions and 26 deletions
  1. +0
    -5
      docs/about.md
  2. +4
    -4
      docs/user-guide-cn/api-interface.md
  3. +8
    -8
      docs/user-guide/api-interface.md
  4. +1
    -1
      docs/user-guide/configuration.md
  5. +1
    -1
      docs/user-guide/faq.md
  6. +1
    -1
      docs/user-guide/getting-started.md
  7. +63
    -6
      mkdocs.yml

+ 0
- 5
docs/about.md View File

@@ -1,5 +0,0 @@

## Contact Us

* Submit an issue
* Email: yangxiaodong1214@126.com

+ 4
- 4
docs/user-guide-cn/api-interface.md View File

@@ -4,7 +4,7 @@ CAP 的 API 接口只有一个,就是 `ICapPublisher` 接口,你可以从 DI


你可以使用 `ICapPublisher` 接口中的 `Publish<T>` 或者 `PublishAsync<T>` 方法来发送消息: 你可以使用 `ICapPublisher` 接口中的 `Publish<T>` 或者 `PublishAsync<T>` 方法来发送消息:


```cs
```c#
public class PublishController : Controller public class PublishController : Controller
{ {
private readonly ICapPublisher _capBus; private readonly ICapPublisher _capBus;
@@ -109,7 +109,7 @@ public DateTime ShowPublishTimeAndReturnExecuteTime(DateTime time)


* EntityFramework * EntityFramework


```cs
```c#
using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false) using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false)
{ {
//业务代码 //业务代码
@@ -128,7 +128,7 @@ using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: fals


* Dapper * Dapper


```cs
```c#
using (var connection = new MySqlConnection(ConnectionString)) using (var connection = new MySqlConnection(ConnectionString))
{ {
using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false))
@@ -201,7 +201,7 @@ public void BarAndFooMessageProcessor()


以下是使用组进行订阅的示例: 以下是使用组进行订阅的示例:


```cs
```c#
[CapSubscribe("xxx.services.foo", Group = "moduleA")] [CapSubscribe("xxx.services.foo", Group = "moduleA")]
public void FooMessageProcessor() public void FooMessageProcessor()
{ {


+ 8
- 8
docs/user-guide/api-interface.md View File

@@ -6,7 +6,7 @@ CAP only has one interface,It is `ICapPublisher`, You can get its instance from


You can use the `Publish<T>` or `PublishAsync<T>` methods defined in the `ICapPublisher` interface to send the event messages. You can use the `Publish<T>` or `PublishAsync<T>` methods defined in the `ICapPublisher` interface to send the event messages.


```cs
```c#
public class PublishController : Controller public class PublishController : Controller
{ {
private readonly ICapPublisher _capBus; private readonly ICapPublisher _capBus;
@@ -48,7 +48,7 @@ public class PublishController : Controller
``` ```
The following is the signature of the of the PublishAsync method The following is the signature of the of the PublishAsync method


```cs
```c#
PublishAsync<T>(string name, T object) PublishAsync<T>(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 In some situations,you may need a callback when a message is sent out, you can use the follwing
overload of the `PublishAsync<T>` method: overload of the `PublishAsync<T>` method:


```cs
```c#
PublishAsync<T>(string name, T object, string callBackName) PublishAsync<T>(string name, T object, string callBackName)
``` ```


@@ -80,7 +80,7 @@ The following two blocks of code snippet demonstrate how to use transactions in


#### EntityFramework #### EntityFramework


```cs
```c#
using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false) using (var trans = dbContext.Database.BeginTransaction(_capBus, autoCommit: false)
{ {
// Your business logic。 // Your business logic。
@@ -99,7 +99,7 @@ During the course,the message content will be serialized as json and stored in t


#### Dapper #### Dapper


```cs
```c#
using (var connection = new MySqlConnection(ConnectionString)) using (var connection = new MySqlConnection(ConnectionString))
{ {
using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) 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. Use `CapSubscribe[""]` to decorate a method so that it can subscribe messages published by CAP.


```cs
```c#
[CapSubscribe("xxx.services.bar")] [CapSubscribe("xxx.services.bar")]
public void BarMessageProcessor() 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. 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.bar")]
[CapSubscribe("xxx.services.foo")] [CapSubscribe("xxx.services.foo")]
public void BarAndFooMessageProcessor() 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. the following is a demo shows how to use group when subscribing.


```cs
```c#
[CapSubscribe("xxx.services.foo", Group = "moduleA")] [CapSubscribe("xxx.services.foo", Group = "moduleA")]
public void FooMessageProcessor() public void FooMessageProcessor()
{ {


+ 1
- 1
docs/user-guide/configuration.md View File

@@ -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: CAP uses PostgreSql configuration functions for CapOptions extensions, so the configuration usage for PostgreSql is as follows:


```cs
```c#
services.AddCap(capOptions => { services.AddCap(capOptions => {
capOptions.UsePostgreSql(postgreOptions => { capOptions.UsePostgreSql(postgreOptions => {
// postgreOptions.ConnectionString // postgreOptions.ConnectionString


+ 1
- 1
docs/user-guide/faq.md View File

@@ -16,7 +16,7 @@ defining a prefix name of table in `ConfigureServices` method。
codes exsample: codes exsample:


```cs
```c#
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddCap(x => services.AddCap(x =>


+ 1
- 1
docs/user-guide/getting-started.md View File

@@ -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()`: 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) public void ConfigureServices(IServiceCollection services)
{ {
//...... //......


+ 63
- 6
mkdocs.yml View File

@@ -1,7 +1,17 @@
# Project information
site_name: CAP 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 &copy; 2017 <a href="https://github.com/dotnetcore">.NET Core Community</a>, Maintained by the <a href="/about/contact-us/#cap-team">CAP Team</a>.

nav: nav:
- Home: index.md - Home: index.md
- <img src="https://www.countryflags.io/us/flat/16.png">User Guide:
- User Guide:
- Getting Started: user-guide/getting-started.md - Getting Started: user-guide/getting-started.md
- API Interface: user-guide/api-interface.md - API Interface: user-guide/api-interface.md
- Configuration: user-guide/configuration.md - Configuration: user-guide/configuration.md
@@ -9,7 +19,7 @@ nav:
- Implementation Mechanisms: user-guide/implementation-mechanisms.md - Implementation Mechanisms: user-guide/implementation-mechanisms.md
- Distributed Transactions: user-guide/distributed-transactions.md - Distributed Transactions: user-guide/distributed-transactions.md
- FAQ: user-guide/faq.md - FAQ: user-guide/faq.md
- <img src="https://www.countryflags.io/cn/flat/16.png">使用指南:
- 使用指南:
- 快速开始: user-guide-cn/getting-started.md - 快速开始: user-guide-cn/getting-started.md
- API 接口: user-guide-cn/api-interface.md - API 接口: user-guide-cn/api-interface.md
- 配置: user-guide-cn/configuration.md - 配置: user-guide-cn/configuration.md
@@ -17,8 +27,55 @@ nav:
- 实现: user-guide-cn/implementation-mechanisms.md - 实现: user-guide-cn/implementation-mechanisms.md
- 分布式事务: user-guide-cn/distributed-transactions.md - 分布式事务: user-guide-cn/distributed-transactions.md
- FAQ: user-guide-cn/faq.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: markdown_extensions:
- admonition
repo_url: "https://github.com/dotnetcore/CAP"
- 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

Loading…
Cancel
Save