Exemple #1
0
        public static INetworkBuilder AddDotNetty <TDependency>(this INetworkBuilder builder,
                                                                Action <TDependency> configureDependency = null)
            where TDependency : DotNettyDependency
        {
            // Clear Options Cache
            ConsistencyOptionsCache.TryRemove <DotNettyOptions>();

            AddDotNettyServiceCharacteristics();

            // Add Builder Dependency
            var dependency = builder.AddBuilderDependency(out var dependencyType, configureDependency);

            builder.Services.TryAddReferenceBuilderDependency <DotNettyDependency>(dependency, dependencyType);

            builder.SetProperty(p => p.DotNettyDependency, dependency);

            // Configure Builder
            return(builder.AddDotNettyServices());
        }
Exemple #2
0
 /// <summary>
 /// 添加 DotNetty 扩展。
 /// </summary>
 /// <param name="builder">给定的 <see cref="INetworkBuilder"/>。</param>
 /// <param name="configureDependency">给定的配置依赖动作方法(可选)。</param>
 /// <returns>返回 <see cref="INetworkBuilder"/>。</returns>
 public static INetworkBuilder AddDotNetty(this INetworkBuilder builder,
                                           Action <DotNettyDependency> configureDependency = null)
 => builder.AddDotNetty <DotNettyDependency>(configureDependency);