Browse Source

update samples.

master
yangxiaodong 7 years ago
parent
commit
f30c905f0f
4 changed files with 15 additions and 11 deletions
  1. +1
    -1
      samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs
  2. +2
    -2
      samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs
  3. +3
    -7
      samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs
  4. +9
    -1
      samples/Sample.RabbitMQ.SqlServer/Startup.cs

+ 1
- 1
samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs View File

@@ -24,7 +24,7 @@ namespace Sample.RabbitMQ.MySql.Controllers
public IActionResult PublishMessage()
{
_capBus.Publish("sample.rabbitmq.mysql", DateTime.Now);
return Ok();
}



+ 2
- 2
samples/Sample.RabbitMQ.SqlServer/AppDbContext.cs View File

@@ -10,8 +10,8 @@ namespace Sample.RabbitMQ.SqlServer

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=TestCap;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=192.168.2.206;Initial Catalog=TestCap;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");
}
}
}

+ 3
- 7
samples/Sample.RabbitMQ.SqlServer/Controllers/ValuesController.cs View File

@@ -35,13 +35,9 @@ namespace Sample.RabbitMQ.SqlServer.Controllers
[Route("~/publish")]
public IActionResult PublishMessage()
{
var person = new Person { Name = "宜兴", Age = 11 };

_dbContext.Persons.Add(person);
_dbContext.SaveChanges();
throw new Exception();
//_capBus.Publish("sample.rabbitmq.mysql22222", DateTime.Now);
_capBus.Publish("sample.rabbitmq.mysql33333", person);
_capBus.Publish("sample.rabbitmq.mysql22222", DateTime.Now);
// _capBus.Publish("sample.rabbitmq.mysql33333", person);

return Ok();
}


+ 9
- 1
samples/Sample.RabbitMQ.SqlServer/Startup.cs View File

@@ -19,7 +19,13 @@ namespace Sample.RabbitMQ.SqlServer
services.AddCap(x =>
{
x.UseEntityFramework<AppDbContext>();
x.UseRabbitMQ("localhost");
x.UseRabbitMQ(xx =>
{
xx.HostName = "192.168.2.206";
xx.UserName = "admin";
xx.Password = "123123";
});
x.UseDashboard();
});

services.AddMvc();
@@ -33,6 +39,8 @@ namespace Sample.RabbitMQ.SqlServer
app.UseMvc();

app.UseCap();

app.UseCapDashboard();
}
}
}

Loading…
Cancel
Save