Ejemplo n.º 1
0
        public static LongIdBroker AsIdBroker(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <LongIdBroker>();

            return(rv);
        }
Ejemplo n.º 2
0
        public static BackgroundHost AsBackground(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <BackgroundHost>();

            return(rv);
        }
Ejemplo n.º 3
0
        public static HasAdjustment <T> AsHasAdjustment <T>(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <HasAdjustment <T> >();

            return(rv);
        }
Ejemplo n.º 4
0
        public static StrategizedTouchable AsStrategizedTouchable(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.AsHasTouchable();

            return(rv.With(x => x.Touchable) as StrategizedTouchable);
        }
Ejemplo n.º 5
0
        public static NaturalDatedExpirable AsDatedExpirable(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <NaturalDatedExpirable>();

            return(rv);
        }
Ejemplo n.º 6
0
        public static HasExpirable AsHasExpirable(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <HasExpirable>();

            return(rv);
        }
Ejemplo n.º 7
0
        public static ConditionalWaiter AsConditionalWaiter(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <ConditionalWaiter>();

            return(rv);
        }
Ejemplo n.º 8
0
        public static IItemValidator AsHasItemValidator(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <HasItemValidator>();

            return(rv);
        }
Ejemplo n.º 9
0
        public static NaturalThrottle AsThrottle(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var rv = root.As <NaturalThrottle>();

            return(rv);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        public static Polyface IsDatedExpirable(this Polyface root, DateTime expiry)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalDatedExpirable(expiry);

            root.Is(composited);
            return(root);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        public static Polyface IsThrottle(this Polyface root, int maxConcurrency)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new NaturalThrottle(maxConcurrency);

            root.Is(composited);
            return(root);
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        public static Polyface IsStrategizedTouchable(this Polyface root, ILogic logic)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new StrategizedTouchable(logic);

            root.IsHasTouchable(composited);
            return(root);
        }
Ejemplo n.º 17
0
        public static Polyface IsCounter(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var counter = new Counter();

            root.Is(counter);
            return(root);
        }
Ejemplo n.º 18
0
        public static Polyface IsHasExpirable(this Polyface root, IExpirable expirable)
        {
            Condition.Requires(root).IsNotNull();
            var composited = new HasExpirable(expirable);

            root.Is(composited);
            return(root);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
        public static Polyface IsEmptyBackground(this Polyface root)
        {
            Condition.Requires(root).IsNotNull();
            var bg = BackgroundHost.NewBlank();

            root.Is(bg);
            return(root);
        }
Ejemplo n.º 21
0
        public static Polyface IsHasItemValidator(this Polyface root, IItemValidator validator)
        {
            Condition.Requires(root).IsNotNull();
            var obj = HasItemValidator.New(validator);

            root.Is(obj);
            return(root);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
        public static IExpirable BuildTouchLimitExpirable(int limit)
        {
            //fluently build something that Counts, and has a condition on that count, and is touchable
            var pf = Polyface.New();

            pf.IsCounter();
            pf.IsConditionalExpirable(StrategizedConditionOf <Polyface> .New((pf1) => { return(pf1.AsCounter().Current > limit); }));
            pf.IsStrategizedTouchable(LogicOf <Polyface> .New((pf1) => { pf1.AsCounter().Increment(); }));

            //var expire = NaturalFalseExpirable.New().ExpiresWhen( .InWindow(startDate, endDate);
            // return expire;
            return(pf.AsConditionalExpirable());
        }