@@ -1,5 +0,0 @@ | |||
## Contact Us | |||
* Submit an issue | |||
* Email: yangxiaodong1214@126.com |
@@ -4,7 +4,7 @@ CAP 的 API 接口只有一个,就是 `ICapPublisher` 接口,你可以从 DI | |||
你可以使用 `ICapPublisher` 接口中的 `Publish<T>` 或者 `PublishAsync<T>` 方法来发送消息: | |||
```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() | |||
{ | |||
@@ -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. | |||
```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<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 | |||
overload of the `PublishAsync<T>` method: | |||
```cs | |||
```c# | |||
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 | |||
```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() | |||
{ | |||
@@ -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 | |||
@@ -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 => | |||
@@ -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) | |||
{ | |||
//...... | |||
@@ -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 <a href="https://github.com/dotnetcore">.NET Core Community</a>, Maintained by the <a href="/about/contact-us/#cap-team">CAP Team</a>. | |||
nav: | |||
- Home: index.md | |||
- <img src="https://www.countryflags.io/us/flat/16.png">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 | |||
- <img src="https://www.countryflags.io/cn/flat/16.png">使用指南: | |||
- 使用指南: | |||
- 快速开始: 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" | |||
- 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 |