Commit 80406124 authored by yangxiaodong's avatar yangxiaodong

update samples

parent 8b2a6ee7
...@@ -8,7 +8,8 @@ namespace Sample.Kafka ...@@ -8,7 +8,8 @@ namespace Sample.Kafka
{ {
public class Startup public class Startup
{ {
public Startup(IHostingEnvironment env) { public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder() var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath) .SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
...@@ -20,19 +21,27 @@ namespace Sample.Kafka ...@@ -20,19 +21,27 @@ namespace Sample.Kafka
public IConfigurationRoot Configuration { get; } public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) { public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AppDbContext>(); services.AddDbContext<AppDbContext>();
services.AddConsistency() services.AddConsistency()
.AddEntityFrameworkStores<AppDbContext>() .AddEntityFrameworkStores<AppDbContext>()
.AddKafka(); .AddRabbitMQ(x =>
{
x.HostName = "192.168.2.206";
x.UserName = "admin";
x.Password = "123123";
});
//.AddKafka();
// Add framework services. // Add framework services.
services.AddMvc(); services.AddMvc();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment