From 6cd228676cc7c2b81408a3f9b12815d2b3dcdec6 Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Mon, 29 May 2017 18:45:38 +0800 Subject: [PATCH] modify extensions --- src/Cap.Consistency/Extensions/BuilderExtensions.cs | 2 +- src/Cap.Consistency/Extensions/ConsistencyOptions.cs | 12 ------------ .../Extensions/ServiceCollectionExtensions.cs | 6 ++---- 3 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 src/Cap.Consistency/Extensions/ConsistencyOptions.cs diff --git a/src/Cap.Consistency/Extensions/BuilderExtensions.cs b/src/Cap.Consistency/Extensions/BuilderExtensions.cs index 76fe38d..675bae3 100644 --- a/src/Cap.Consistency/Extensions/BuilderExtensions.cs +++ b/src/Cap.Consistency/Extensions/BuilderExtensions.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Builder var context = new TopicRouteContext(); - router.RouteAsync(context).Wait(); + router.RouteAsync(context); return app; } diff --git a/src/Cap.Consistency/Extensions/ConsistencyOptions.cs b/src/Cap.Consistency/Extensions/ConsistencyOptions.cs deleted file mode 100644 index 53e21c9..0000000 --- a/src/Cap.Consistency/Extensions/ConsistencyOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Cap.Consistency; - -namespace Microsoft.AspNetCore.Builder -{ - /// - /// Represents all the options you can use to configure the system. - /// - public class ConsistencyOptions - { - public string BrokerUrlList { get; set; } = "localhost:9092"; - } -} \ No newline at end of file diff --git a/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs b/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs index f4d1402..70712fd 100644 --- a/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs +++ b/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs @@ -19,7 +19,7 @@ namespace Microsoft.Extensions.DependencyInjection /// An for application services. public static ConsistencyBuilder AddConsistency(this IServiceCollection services) where TMessage : ConsistencyMessage { - return services.AddConsistency(setupAction: null); + return services.AddConsistency(x => new ConsistencyOptions()); } /// @@ -34,9 +34,7 @@ namespace Microsoft.Extensions.DependencyInjection services.TryAddScoped, ConsistencyMessageManager>(); - if (setupAction != null) { - services.Configure(setupAction); - } + services.Configure(setupAction); return new ConsistencyBuilder(typeof(TMessage), services); }