Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
85577e38
Commit
85577e38
authored
Aug 13, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sampels.
parent
cfa02281
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
18 deletions
+31
-18
AppDbContext.cs
samples/Sample.RabbitMQ.MySql/AppDbContext.cs
+1
-1
ValuesController.cs
...les/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs
+12
-2
Sample.RabbitMQ.MySql.csproj
samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj
+17
-14
Startup.cs
samples/Sample.RabbitMQ.MySql/Startup.cs
+1
-1
No files found.
samples/Sample.RabbitMQ.MySql/AppDbContext.cs
View file @
85577e38
...
...
@@ -10,7 +10,7 @@ namespace Sample.RabbitMQ.MySql
{
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
{
optionsBuilder
.
UseMySql
(
"Server=localhost;Database=Sample.RabbitMQ.MySql;U
id=root;Pw
d=123123;"
);
optionsBuilder
.
UseMySql
(
"Server=localhost;Database=Sample.RabbitMQ.MySql;U
serId=root;Passwor
d=123123;"
);
}
}
}
samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs
View file @
85577e38
...
...
@@ -23,7 +23,16 @@ namespace Sample.RabbitMQ.MySql.Controllers
[
Route
(
"~/publish"
)]
public
IActionResult
PublishMessage
()
{
_capBus
.
Publish
(
"sample.kafka.sqlserver"
,
""
);
_capBus
.
Publish
(
"sample.rabbitmq.mysql"
,
DateTime
.
Now
);
return
Ok
();
}
[
Route
(
"~/publish2"
)]
public
IActionResult
PublishMessage2
()
{
_capBus
.
Publish
(
"sample.kafka.sqlserver4"
,
DateTime
.
Now
);
return
Ok
();
}
...
...
@@ -34,11 +43,12 @@ namespace Sample.RabbitMQ.MySql.Controllers
using
(
var
trans
=
await
_dbContext
.
Database
.
BeginTransactionAsync
())
{
await
_capBus
.
PublishAsync
(
"sample.kafka.sqlserver"
,
""
);
trans
.
Commit
();
}
return
Ok
();
}
[
NonAction
]
[
CapSubscribe
(
"sample.rabbitmq.mysql"
)]
public
void
ReceiveMessage
()
...
...
samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj
View file @
85577e38
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;1705;3277;</NoWarn>
<WarningsAsErrors>NU1605;MSB3277</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="1.1.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.0-preview3-10055" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetCore.CAP.
Kafka\DotNetCore.CAP.Kafka
.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.
MySql\DotNetCore.CAP.MySql
.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.
PostgreSql\DotNetCore.CAP.PostgreSql
.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.
RabbitMQ\DotNetCore.CAP.RabbitMQ
.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP\DotNetCore.CAP.csproj" />
</ItemGroup>
...
...
samples/Sample.RabbitMQ.MySql/Startup.cs
View file @
85577e38
...
...
@@ -18,7 +18,7 @@ namespace Sample.RabbitMQ.MySql
services
.
AddCap
(
x
=>
{
x
.
UseEntityFramework
<
AppDbContext
>();
x
.
Use
Kafka
(
"localhost:9092
"
);
x
.
Use
RabbitMQ
(
"localhost
"
);
});
services
.
AddMvc
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment