Beispiel #1
0
        public static IHasExpirable InWindow(this IHasExpirable thing, DateTime startDate, DateTime endDate)
        {
            Condition.Requires(thing).IsNotNull();
            thing.Expirable = thing.Expirable.DecorateWithWindowExpirable(startDate, endDate);

            return(thing);
        }
Beispiel #2
0
        public static IHasExpirable ExpiresWhen(this IHasExpirable thing, ICondition condition)
        {
            Condition.Requires(thing).IsNotNull();
            thing.Expirable = thing.Expirable.DecorateWithConditionalExpirable(condition);

            return(thing);
        }
        public static IHasExpirable Touch(this IHasExpirable thing)
        {
            Condition.Requires(thing).IsNotNull();

            if (thing.Expirable is ITouchable)
            {
                ((ITouchable)thing.Expirable).Touch();
            }

            return(thing);
        }
        public static IHasExpirable ExpiryFloats(this IHasExpirable thing, int touchIncrementSecs)
        {
            Condition.Requires(thing).IsNotNull();
            if (!(thing.Expirable is DateExpirableDecoration))
            {
                throw new InvalidOperationException("expirable must be DateExpirableDecoration");
            }

            var dateExpire = thing.Expirable as DateExpirableDecoration;

            thing.Expirable = dateExpire.DecorateWithFloatingDateExpirable(touchIncrementSecs);

            return(thing);
        }