public static IAccessControlBuilder AddControlAccessStrategy <TControlAccessStrategy>(this IAccessControlBuilder builder, ServiceLifetime serviceLifetime) where TControlAccessStrategy : IControlAccessStrategy { if (null == builder) { throw new ArgumentNullException(nameof(builder)); } builder.Services.Add(new ServiceDescriptor(typeof(IControlAccessStrategy), typeof(TControlAccessStrategy), serviceLifetime)); return(builder); }
public static IAccessControlBuilder AddControlAccessStrategy <TControlAccessStrategy>(this IAccessControlBuilder builder) where TControlAccessStrategy : IControlAccessStrategy { return(AddControlAccessStrategy <TControlAccessStrategy>(builder, ServiceLifetime.Singleton)); }