Example #1
0
        public static Polyface IsBackground(this Polyface root, bool isEnabled, double backgroundIntervalMSecs, ILogic backgroundAction)
        {
            Condition.Requires(root).IsNotNull();
            var bg = BackgroundHost.New(isEnabled, backgroundIntervalMSecs, backgroundAction);

            root.Is(bg);
            return(root);
        }
Example #2
0
        public static Polyface IsHasItemValidator(this Polyface root, IItemValidator validator)
        {
            Condition.Requires(root).IsNotNull();
            var obj = HasItemValidator.New(validator);

            root.Is(obj);
            return(root);
        }
Example #3
0
        public static Polyface IsEmptyBackground(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var bg = BackgroundHost.NewBlank();

            root.Is(bg);
            return(root);
        }
Example #4
0
        public static Polyface IsHasAdjustment <T>(this Polyface root, IAdjustment <T> adjustment)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new HasAdjustment <T>(adjustment);

            root.Is(composited);
            return(root);
        }
Example #5
0
        public static Polyface IsConditionalWaiter(this Polyface root, ICondition condition, ICondition stopWaitingCondition)
        {
            Condition.Requires(root).IsNotNull();
            var bg = new ConditionalWaiter(condition, stopWaitingCondition);

            root.Is(bg);
            return(root);
        }
        public static Polyface IsDatedExpirable(this Polyface root, DateTime expiry)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalDatedExpirable(expiry);

            root.Is(composited);
            return(root);
        }
Example #7
0
        public static Polyface IsConditionalExpirable(this Polyface root, IConditionOf <Polyface> expiry)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalConditionalExpirable(expiry.WithValue(root.AsNaturalValue()));

            root.Is(composited);
            return(root);
        }
Example #8
0
        public static Polyface IsThrottle(this Polyface root, int maxConcurrency)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalThrottle(maxConcurrency);

            root.Is(composited);
            return(root);
        }
Example #9
0
        public static Polyface IsHasExpirable(this Polyface root, IExpirable expirable)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new HasExpirable(expirable);

            root.Is(composited);
            return(root);
        }
Example #10
0
        public static Polyface IsFloatingDatedExpirable(this Polyface root, DateTime expiry, int touchIncrementSecs)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalFloatingDatedExpirable(expiry, touchIncrementSecs);

            root.Is(composited);
            return(root);
        }
Example #11
0
        public static Polyface IsCounter(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var counter = new Counter();

            root.Is(counter);
            return(root);
        }
Example #12
0
        public static Polyface IsIdBroker(this Polyface root,
                                          string generatorId,
                                          IStore store,
                                          int rangeSize  = 1000,
                                          int maxRetries = 25)
        {
            Condition.Requires(root).IsNotNull();
            var obj = new LongIdBroker(generatorId, store, rangeSize, maxRetries);

            root.Is(obj);
            return(root);
        }