/// <summary> /// Enable the code feature between the specified dates /// </summary> /// <typeparam name="T"></typeparam> /// <param name="factory"></param> /// <param name="startDateTime"></param> /// <param name="endDateTime"></param> /// <param name="currentTimeProvider"></param> /// <returns></returns> public static IToggleCodeSwitch <T> EnableBetween <T>(this ICodeSwitchFactory factory, DateTime startDateTime, DateTime endDateTime, CurrentTimeProvider currentTimeProvider = null) where T : struct, ICodeFeature { return(new DateRangeCodeSwitch <T>(true, startDateTime, endDateTime, currentTimeProvider ?? DefaultTimeProvider)); }
/// <summary> /// Enable the code feature until the specified date/time /// </summary> /// <typeparam name="T"></typeparam> /// <param name="factory"></param> /// <param name="dateTime"></param> /// <param name="currentTimeProvider"></param> /// <returns></returns> public static IToggleCodeSwitch <T> EnableUntil <T>(this ICodeSwitchFactory factory, DateTime dateTime, CurrentTimeProvider currentTimeProvider = null) where T : struct, ICodeFeature { return(new DateRangeCodeSwitch <T>(true, null, dateTime, currentTimeProvider ?? DefaultTimeProvider)); }
/// <summary> /// Enabled if the current principal identity is authenticated /// </summary> /// <typeparam name="TFeature">The code feature</typeparam> /// <returns></returns> public static ICodeSwitch <TFeature> EnabledForAuthenticatedIdentity <TFeature>(this ICodeSwitchFactory factory) where TFeature : struct, ICodeFeature { return(new EnabledForAuthenticatedIdentityCodeSwitch <TFeature>()); }
/// <summary> /// Enables the feature if the principal in is in the specified role /// </summary> /// <typeparam name="TFeature"></typeparam> /// <param name="factory"></param> /// <param name="role">The role required to enable the switch</param> /// <returns></returns> public static ICodeSwitch <TFeature> EnabledForPrincipalInRole <TFeature>(this ICodeSwitchFactory factory, string role) where TFeature : struct, ICodeFeature { return(new EnabledForThreadPrincipalInRoleCodeSwitch <TFeature>(role)); }