Esempio n. 1
0
        public void OnCreating(CreatingContext filterContext)
        {
            var lazyContextActions = ConsumableThreadStorage <Action <CreatingContext> > .GetAllAndClear();

            foreach (var action in lazyContextActions)
            {
                action.Invoke(filterContext);
            }
        }
        public static IBackgroundJobClient AddOrUpdateMeta <T>([NotNull] this IBackgroundJobClient client, [NotNull] string key, [NotNull] T value)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            ConsumableThreadStorage <Action <CreatingContext> > .Add(context => context.SetJobParameter(key, value));

            return(client);
        }