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
1bb0c8d5
Commit
1bb0c8d5
authored
Aug 25, 2018
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sqlserver samples
parent
45bd5ed2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
22 deletions
+19
-22
CAP.sln
CAP.sln
+9
-9
ValuesController.cs
...es/Sample.Kafka.SqlServer/Controllers/ValuesController.cs
+2
-4
Program.cs
samples/Sample.Kafka.SqlServer/Program.cs
+1
-1
Sample.Kafka.SqlServer.csproj
samples/Sample.Kafka.SqlServer/Sample.Kafka.SqlServer.csproj
+3
-2
Startup.cs
samples/Sample.Kafka.SqlServer/Startup.cs
+4
-6
appsettings.json
samples/Sample.Kafka.SqlServer/appsettings.json
+0
-0
No files found.
CAP.sln
View file @
1bb0c8d5
...
...
@@ -58,13 +58,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.PostgreSql",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.PostgreSql.Test", "test\DotNetCore.CAP.PostgreSql.Test\DotNetCore.CAP.PostgreSql.Test.csproj", "{7CA3625D-1817-4695-881D-7E79A1E1DED2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "
Sample.Kafka.MySql", "samples\Sample.Kafka.MySql\Sample.Kafka.MySql.csproj", "{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91
}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "
DotNetCore.CAP.MongoDB.Test", "test\DotNetCore.CAP.MongoDB.Test\DotNetCore.CAP.MongoDB.Test.csproj", "{C143FCDF-E7F3-46F8-987E-A1BA38C1639D
}"
EndProject
Project("{
FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetCore.CAP.MongoDB.Test", "test\DotNetCore.CAP.MongoDB.Test\DotNetCore.CAP.MongoDB.Test.csproj", "{C143FCDF-E7F3-46F8-987E-A1BA38C1639D
}"
Project("{
9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.MongoDB", "src\DotNetCore.CAP.MongoDB\DotNetCore.CAP.MongoDB.csproj", "{77C0AC02-C44B-49D5-B969-7D5305FC20A5
}"
EndProject
Project("{
FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetCore.CAP.MongoDB", "src\DotNetCore.CAP.MongoDB\DotNetCore.CAP.MongoDB.csproj", "{77C0AC02-C44B-49D5-B969-7D5305FC20A5
}"
Project("{
9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.RabbitMQ.MongoDB", "samples\Sample.RabbitMQ.MongoDB\Sample.RabbitMQ.MongoDB.csproj", "{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F
}"
EndProject
Project("{
FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.RabbitMQ.MongoDB", "samples\Sample.RabbitMQ.MongoDB\Sample.RabbitMQ.MongoDB.csproj", "{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F
}"
Project("{
9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.SqlServer", "samples\Sample.Kafka.SqlServer\Sample.Kafka.SqlServer.csproj", "{CD276810-09A2-4105-8798-D65A8AA7C509
}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
@@ -115,10 +115,6 @@ Global
{7CA3625D-1817-4695-881D-7E79A1E1DED2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CA3625D-1817-4695-881D-7E79A1E1DED2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CA3625D-1817-4695-881D-7E79A1E1DED2}.Release|Any CPU.Build.0 = Release|Any CPU
{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91}.Release|Any CPU.Build.0 = Release|Any CPU
{C143FCDF-E7F3-46F8-987E-A1BA38C1639D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C143FCDF-E7F3-46F8-987E-A1BA38C1639D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C143FCDF-E7F3-46F8-987E-A1BA38C1639D}.Release|Any CPU.ActiveCfg = Release|Any CPU
...
...
@@ -131,6 +127,10 @@ Global
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F}.Release|Any CPU.Build.0 = Release|Any CPU
{CD276810-09A2-4105-8798-D65A8AA7C509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD276810-09A2-4105-8798-D65A8AA7C509}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD276810-09A2-4105-8798-D65A8AA7C509}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD276810-09A2-4105-8798-D65A8AA7C509}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -147,10 +147,10 @@ Global
{9F3F9BFE-7B6A-4A7A-A6E6-8B517D611873} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{82C403AB-ED68-4084-9A1D-11334F9F08F9} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
{7CA3625D-1817-4695-881D-7E79A1E1DED2} = {C09CDAB0-6DD4-46E9-B7F3-3EF2A4741EA0}
{9CB51105-A85B-42A4-AFDE-A4FC34D9EA91} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{C143FCDF-E7F3-46F8-987E-A1BA38C1639D} = {C09CDAB0-6DD4-46E9-B7F3-3EF2A4741EA0}
{77C0AC02-C44B-49D5-B969-7D5305FC20A5} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F} = {3A6B6931-A123-477A-9469-8B468B5385AF}
{CD276810-09A2-4105-8798-D65A8AA7C509} = {3A6B6931-A123-477A-9469-8B468B5385AF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E70565D-94CF-40B4-BFE1-AC18D5F736AB}
...
...
samples/Sample.Kafka.
MySql
/Controllers/ValuesController.cs
→
samples/Sample.Kafka.
SqlServer
/Controllers/ValuesController.cs
View file @
1bb0c8d5
using
System
;
using
System.Data
;
using
System.Data.SqlClient
;
using
Dapper
;
using
DotNetCore.CAP
;
using
Microsoft.AspNetCore.Mvc
;
//using MySql.Data.MySqlClient;
namespace
Sample.Kafka.
MySql
.Controllers
namespace
Sample.Kafka.
SqlServer
.Controllers
{
[
Route
(
"api/[controller]"
)]
public
class
ValuesController
:
Controller
...
...
@@ -34,7 +32,7 @@ namespace Sample.Kafka.MySql.Controllers
using
(
var
transaction
=
connection
.
BeginTransaction
(
_capBus
,
autoCommit
:
false
))
{
//your business code
connection
.
Execute
(
"insert into dbo.test1(tname) values('test');"
,
transaction
:
(
IDbTransaction
)
transaction
.
DbT
ransaction
);
connection
.
Execute
(
"insert into dbo.test1(tname) values('test');"
,
transaction
:
t
ransaction
);
_capBus
.
Publish
(
"sample.rabbitmq.mysql"
,
DateTime
.
Now
);
...
...
samples/Sample.Kafka.
MySql
/Program.cs
→
samples/Sample.Kafka.
SqlServer
/Program.cs
View file @
1bb0c8d5
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
namespace
Sample.Kafka.
MySql
namespace
Sample.Kafka.
SqlServer
{
public
class
Program
{
...
...
samples/Sample.Kafka.
MySql/Sample.Kafka.MySql
.csproj
→
samples/Sample.Kafka.
SqlServer/Sample.Kafka.SqlServer
.csproj
View file @
1bb0c8d5
...
...
@@ -2,9 +2,10 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Sample.Kafka.
MySql
</AssemblyName>
<AssemblyName>Sample.Kafka.
SqlServer
</AssemblyName>
<WarningsAsErrors>NU1701</WarningsAsErrors>
<NoWarn>NU1701</NoWarn>
<RootNamespace>Sample.Kafka.SqlServer</RootNamespace>
</PropertyGroup>
<ItemGroup>
...
...
@@ -12,7 +13,7 @@
</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.
SqlServer\DotNetCore.CAP.SqlServer
.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP\DotNetCore.CAP.csproj" />
</ItemGroup>
...
...
samples/Sample.Kafka.
MySql
/Startup.cs
→
samples/Sample.Kafka.
SqlServer
/Startup.cs
View file @
1bb0c8d5
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.Extensions.DependencyInjection
;
namespace
Sample.Kafka.
MySql
namespace
Sample.Kafka.
SqlServer
{
public
class
Startup
{
public
const
string
ConnectionString
=
"Server=localhost;Database=testcap;UserId=root;Password=123123;"
;
//public const string ConnectionString = "Server=(localdb)\\ProjectsV13;Integrated Security=SSPI;Database=testcap";
public
const
string
ConnectionString
=
"Server=localhost;Integrated Security=SSPI;Database=testcap"
;
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddCap
(
x
=>
{
x
.
UseMySql
(
ConnectionString
);
//x.UseSqlServer(ConnectionString);
x
.
UseKafka
(
"192.168.10.110:9092"
);
x
.
UseSqlServer
(
ConnectionString
);
x
.
UseKafka
(
"localhost:9092"
);
x
.
UseDashboard
();
});
...
...
samples/Sample.Kafka.
MySql
/appsettings.json
→
samples/Sample.Kafka.
SqlServer
/appsettings.json
View file @
1bb0c8d5
File moved
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