From 99c12441cb501aaf62e170e66a3d024db1ea4a42 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Thu, 12 Dec 2019 10:23:37 +0800 Subject: [PATCH] update samples --- CAP.sln | 14 +++++++------- .../Controllers/ValuesController.cs | 6 +++--- .../Program.cs | 5 ++--- .../Sample.Kafka.PostgreSql.csproj} | 2 +- .../Startup.cs | 2 +- .../appsettings.json | 0 6 files changed, 14 insertions(+), 15 deletions(-) rename samples/{Sample.Kafka.MySql => Sample.Kafka.PostgreSql}/Controllers/ValuesController.cs (91%) rename samples/{Sample.Kafka.MySql => Sample.Kafka.PostgreSql}/Program.cs (82%) rename samples/{Sample.Kafka.MySql/Sample.Kafka.MySql.csproj => Sample.Kafka.PostgreSql/Sample.Kafka.PostgreSql.csproj} (83%) rename samples/{Sample.Kafka.MySql => Sample.Kafka.PostgreSql}/Startup.cs (86%) rename samples/{Sample.Kafka.MySql => Sample.Kafka.PostgreSql}/appsettings.json (100%) diff --git a/CAP.sln b/CAP.sln index 4bab9bb..453b459 100644 --- a/CAP.sln +++ b/CAP.sln @@ -54,8 +54,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.MongoDB", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.RabbitMQ.MongoDB", "samples\Sample.RabbitMQ.MongoDB\Sample.RabbitMQ.MongoDB.csproj", "{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.MySql", "samples\Sample.Kafka.MySql\Sample.Kafka.MySql.csproj", "{11563D1A-27CC-45CF-8C04-C16BCC21250A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.AzureServiceBus", "src\DotNetCore.CAP.AzureServiceBus\DotNetCore.CAP.AzureServiceBus.csproj", "{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.InMemoryStorage", "src\DotNetCore.CAP.InMemoryStorage\DotNetCore.CAP.InMemoryStorage.csproj", "{58B6E829-C6C8-457C-9DD0-C600650254DF}" @@ -66,6 +64,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.InMemory", "sa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.RabbitMQ.SqlServer", "samples\Sample.RabbitMQ.SqlServer\Sample.RabbitMQ.SqlServer.csproj", "{F6C5C676-AF05-46D5-A45D-442137B31898}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.PostgreSql", "samples\Sample.Kafka.PostgreSql\Sample.Kafka.PostgreSql.csproj", "{F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,10 +115,6 @@ 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 - {11563D1A-27CC-45CF-8C04-C16BCC21250A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {11563D1A-27CC-45CF-8C04-C16BCC21250A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {11563D1A-27CC-45CF-8C04-C16BCC21250A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {11563D1A-27CC-45CF-8C04-C16BCC21250A}.Release|Any CPU.Build.0 = Release|Any CPU {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Debug|Any CPU.Build.0 = Debug|Any CPU {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -139,6 +135,10 @@ Global {F6C5C676-AF05-46D5-A45D-442137B31898}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6C5C676-AF05-46D5-A45D-442137B31898}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6C5C676-AF05-46D5-A45D-442137B31898}.Release|Any CPU.Build.0 = Release|Any CPU + {F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -155,12 +155,12 @@ Global {82C403AB-ED68-4084-9A1D-11334F9F08F9} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} {77C0AC02-C44B-49D5-B969-7D5305FC20A5} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} {4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F} = {3A6B6931-A123-477A-9469-8B468B5385AF} - {11563D1A-27CC-45CF-8C04-C16BCC21250A} = {3A6B6931-A123-477A-9469-8B468B5385AF} {63B2A464-FBEA-42FB-8EFA-98AFA39FC920} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} {58B6E829-C6C8-457C-9DD0-C600650254DF} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} {56FB261C-67AF-4715-9A46-4FA4FAB91B2C} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} {1B0371D6-36A4-4C78-A727-8ED732FDBA1D} = {3A6B6931-A123-477A-9469-8B468B5385AF} {F6C5C676-AF05-46D5-A45D-442137B31898} = {3A6B6931-A123-477A-9469-8B468B5385AF} + {F1EF1D26-8A6B-403E-85B0-250DF44A4A7C} = {3A6B6931-A123-477A-9469-8B468B5385AF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2E70565D-94CF-40B4-BFE1-AC18D5F736AB} diff --git a/samples/Sample.Kafka.MySql/Controllers/ValuesController.cs b/samples/Sample.Kafka.PostgreSql/Controllers/ValuesController.cs similarity index 91% rename from samples/Sample.Kafka.MySql/Controllers/ValuesController.cs rename to samples/Sample.Kafka.PostgreSql/Controllers/ValuesController.cs index 1b935bd..3ba48cc 100644 --- a/samples/Sample.Kafka.MySql/Controllers/ValuesController.cs +++ b/samples/Sample.Kafka.PostgreSql/Controllers/ValuesController.cs @@ -4,9 +4,9 @@ using System.Threading.Tasks; using Dapper; using DotNetCore.CAP; using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; +using Npgsql; -namespace Sample.Kafka.MySql.Controllers +namespace Sample.Kafka.PostgreSql.Controllers { [Route("api/[controller]")] public class ValuesController : Controller, ICapSubscribe @@ -29,7 +29,7 @@ namespace Sample.Kafka.MySql.Controllers [Route("~/adonet/transaction")] public IActionResult AdonetWithTransaction() { - using (var connection = new MySqlConnection("")) + using (var connection = new NpgsqlConnection("")) { using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) { diff --git a/samples/Sample.Kafka.MySql/Program.cs b/samples/Sample.Kafka.PostgreSql/Program.cs similarity index 82% rename from samples/Sample.Kafka.MySql/Program.cs rename to samples/Sample.Kafka.PostgreSql/Program.cs index d9a19a6..80800d1 100644 --- a/samples/Sample.Kafka.MySql/Program.cs +++ b/samples/Sample.Kafka.PostgreSql/Program.cs @@ -1,8 +1,7 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; -namespace Sample.Kafka.MySql +namespace Sample.Kafka.PostgreSql { public class Program { diff --git a/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj b/samples/Sample.Kafka.PostgreSql/Sample.Kafka.PostgreSql.csproj similarity index 83% rename from samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj rename to samples/Sample.Kafka.PostgreSql/Sample.Kafka.PostgreSql.csproj index bf42fb7..701ab23 100644 --- a/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj +++ b/samples/Sample.Kafka.PostgreSql/Sample.Kafka.PostgreSql.csproj @@ -9,7 +9,7 @@ - + diff --git a/samples/Sample.Kafka.MySql/Startup.cs b/samples/Sample.Kafka.PostgreSql/Startup.cs similarity index 86% rename from samples/Sample.Kafka.MySql/Startup.cs rename to samples/Sample.Kafka.PostgreSql/Startup.cs index edaf074..5bda514 100644 --- a/samples/Sample.Kafka.MySql/Startup.cs +++ b/samples/Sample.Kafka.PostgreSql/Startup.cs @@ -10,7 +10,7 @@ namespace Sample.Kafka.MySql { services.AddCap(x => { - x.UseMySql("Server=localhost;Database=testcap;UserId=root;Password=123123;"); + x.UsePostgreSql("Server=localhost;Database=testcap;UserId=root;Password=123123;"); x.UseKafka("localhost:9092"); x.UseDashboard(); }); diff --git a/samples/Sample.Kafka.MySql/appsettings.json b/samples/Sample.Kafka.PostgreSql/appsettings.json similarity index 100% rename from samples/Sample.Kafka.MySql/appsettings.json rename to samples/Sample.Kafka.PostgreSql/appsettings.json