/// <summary> /// Globally disable the filter. Can be enabled as needed via DbContext.EnableFilter(). /// </summary> /// <param name="modelBuilder"></param> /// <param name="filterName"></param> public static void DisableFilterGlobally(this DbModelBuilder modelBuilder, string filterName) { filterName = ScrubFilterName(filterName); GlobalParameterValues.AddOrUpdate(filterName, f => { var newValues = new DynamicFilterParameters(); newValues.Enabled = false; return(newValues); }, (f, currValues) => { currValues.Enabled = false; return(currValues); }); }
public static void SetFilterGlobalParameterValue(this DbContext context, string filterName, string parameterName, object value) { filterName = ScrubFilterName(filterName); if (string.IsNullOrEmpty(parameterName)) { parameterName = GetDefaultParameterNameForFilter(filterName); } GlobalParameterValues.AddOrUpdate(filterName, f => { var newValues = new DynamicFilterParameters(); newValues.SetParameter(parameterName, value); return(newValues); }, (f, currValues) => { currValues.SetParameter(parameterName, value); return(currValues); }); }