From 8bf92138a0e333274c2b42292d935279f5ef407d Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sun, 13 Aug 2017 13:44:16 +0800 Subject: [PATCH] rename project. --- .../AppDbContext.cs | 4 ++-- .../Controllers/ValuesController.cs | 7 ++++-- .../Program.cs | 2 +- .../Sample.RabbitMQ.SqlServer.csproj} | 24 +++++++++---------- .../Startup.cs | 4 ++-- 5 files changed, 21 insertions(+), 20 deletions(-) rename samples/{Sample.Kafka.SqlServer => Sample.RabbitMQ.SqlServer}/AppDbContext.cs (64%) rename samples/{Sample.Kafka.SqlServer => Sample.RabbitMQ.SqlServer}/Controllers/ValuesController.cs (89%) rename samples/{Sample.Kafka.SqlServer => Sample.RabbitMQ.SqlServer}/Program.cs (95%) rename samples/{Sample.Kafka.SqlServer/Sample.Kafka.SqlServer.csproj => Sample.RabbitMQ.SqlServer/Sample.RabbitMQ.SqlServer.csproj} (55%) rename samples/{Sample.Kafka.SqlServer => Sample.RabbitMQ.SqlServer}/Startup.cs (90%) diff --git a/samples/Sample.Kafka.SqlServer/AppDbContext.cs b/samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs similarity index 64% rename from samples/Sample.Kafka.SqlServer/AppDbContext.cs rename to samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs index 53cecb7..6e3ea9c 100644 --- a/samples/Sample.Kafka.SqlServer/AppDbContext.cs +++ b/samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs @@ -1,13 +1,13 @@ using Microsoft.EntityFrameworkCore; -namespace Sample.Kafka +namespace Sample.RabbitMQ.SqlServer { public class AppDbContext : DbContext { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { //optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=Test;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True"); - optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"); + //optionsBuilder.UseSqlServer("Server=DESKTOP-M9R8T31;Initial Catalog=Sample.Kafka.SqlServer;User Id=sa;Password=P@ssw0rd;MultipleActiveResultSets=True"); } } } diff --git a/samples/Sample.Kafka.SqlServer/Controllers/ValuesController.cs b/samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs similarity index 89% rename from samples/Sample.Kafka.SqlServer/Controllers/ValuesController.cs rename to samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs index 61b511a..59a9b17 100644 --- a/samples/Sample.Kafka.SqlServer/Controllers/ValuesController.cs +++ b/samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using DotNetCore.CAP; using Microsoft.AspNetCore.Mvc; -namespace Sample.Kafka.Controllers +namespace Sample.RabbitMQ.SqlServer.Controllers { [Route("api/[controller]")] public class ValuesController : Controller, ICapSubscribe @@ -22,6 +22,7 @@ namespace Sample.Kafka.Controllers public IActionResult PublishMessage() { _capBus.Publish("sample.rabbitmq.mysql", ""); + return Ok(); } @@ -31,13 +32,15 @@ namespace Sample.Kafka.Controllers using (var trans = await _dbContext.Database.BeginTransactionAsync()) { await _capBus.PublishAsync("sample.rabbitmq.mysql", ""); + trans.Commit(); } return Ok(); } [NonAction] - [CapSubscribe("sample.kafka.sqlserver", Group = "test")] + [CapSubscribe("sample.kafka.sqlserver3")] + [CapSubscribe("sample.kafka.sqlserver4")] public void KafkaTest() { Console.WriteLine("[sample.kafka.sqlserver] message received"); diff --git a/samples/Sample.Kafka.SqlServer/Program.cs b/samples/Sample.RabbitMQ.SqlServer/Program.cs similarity index 95% rename from samples/Sample.Kafka.SqlServer/Program.cs rename to samples/Sample.RabbitMQ.SqlServer/Program.cs index 37d3089..2393f73 100644 --- a/samples/Sample.Kafka.SqlServer/Program.cs +++ b/samples/Sample.RabbitMQ.SqlServer/Program.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -namespace Sample.Kafka +namespace Sample.RabbitMQ.SqlServer { public class Program { diff --git a/samples/Sample.Kafka.SqlServer/Sample.Kafka.SqlServer.csproj b/samples/Sample.RabbitMQ.SqlServer/Sample.RabbitMQ.SqlServer.csproj similarity index 55% rename from samples/Sample.Kafka.SqlServer/Sample.Kafka.SqlServer.csproj rename to samples/Sample.RabbitMQ.SqlServer/Sample.RabbitMQ.SqlServer.csproj index 675a95b..9fa7e09 100644 --- a/samples/Sample.Kafka.SqlServer/Sample.Kafka.SqlServer.csproj +++ b/samples/Sample.RabbitMQ.SqlServer/Sample.RabbitMQ.SqlServer.csproj @@ -1,26 +1,24 @@  - netcoreapp1.1 - Sample.Kafka.SqlServer + netcoreapp2.0 + Sample.RabbitMQ.SqlServer - - - - - - - - + + + + + + + - - + - + diff --git a/samples/Sample.Kafka.SqlServer/Startup.cs b/samples/Sample.RabbitMQ.SqlServer/Startup.cs similarity index 90% rename from samples/Sample.Kafka.SqlServer/Startup.cs rename to samples/Sample.RabbitMQ.SqlServer/Startup.cs index 08291c5..523e2d9 100644 --- a/samples/Sample.Kafka.SqlServer/Startup.cs +++ b/samples/Sample.RabbitMQ.SqlServer/Startup.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace Sample.Kafka +namespace Sample.RabbitMQ.SqlServer { public class Startup { @@ -14,7 +14,7 @@ namespace Sample.Kafka services.AddCap(x => { x.UseEntityFramework(); - x.UseKafka("localhost:9092"); + x.UseRabbitMQ("localhost"); }); services.AddMvc();