Esempio n. 1
0
        public SuppliedDependencyDrawing(DebugSuppliedDependency suppliedDependency)
        {
            CssClass = "supplied-dependency";

            if (suppliedDependency.DataTypeSupplied != null && suppliedDependency.DataTypeSupplied.HasData())
            {
                AddChild(new TextDrawing {
                    Text = new[] { "Supply of " + suppliedDependency.DataTypeSupplied }
                });
            }

            if (suppliedDependency.Supplier != null && suppliedDependency.Supplier.HasData())
            {
                AddChild(new SupplierDrawing(suppliedDependency.Supplier));
            }

            if (suppliedDependency.DataSupply != null && suppliedDependency.DataSupply.HasData())
            {
                AddChild(new SupplyDrawing(suppliedDependency.DataSupply));
            }

            if (suppliedDependency.DependentSupplies != null && suppliedDependency.DependentSupplies.Count > 0)
            {
                var dependencies = suppliedDependency.DependentSupplies.Select(s => "Depends on " + s.ToString());
                AddChild(new TitledListDrawing(null, dependencies));
            }
        }
Esempio n. 2
0
        protected override T PopulateDebugInfo <T>(DebugInfo debugInfo, int parentDepth, int childDepth)
        {
            if (typeof(T).IsAssignableFrom(typeof(DebugRegion)))
            {
                var debugRegion = debugInfo as DebugRegion ?? new DebugRegion();

                debugRegion.Scope       = Element.GetDebugInfo <DebugDataScopeRules>(0, 0);
                debugRegion.DataContext = _dataContextBuilder.GetDebugInfo <DebugDataScopeRules>();

                debugRegion.DataSupply = new DebugDataSupply
                {
                    Instance        = this,
                    IsStatic        = false,
                    SubscriberCount = _onSupplyActions.Count,
                    SuppliedData    = new DebugDataScope
                    {
                        DataType  = Region.RepeatType,
                        ScopeName = Region.RepeatScope
                    },
                    Supplier = new DebugDataSupplier
                    {
                        Instance = this,
                        Name     = Region.Name + " page region",
                    }
                };

                return(base.PopulateDebugInfo <T>(debugRegion, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataScopeRules)))
            {
                var debugDataScopeRules = ElementDataScopeRules == null
                    ? new DebugDataScopeRules()
                    : ElementDataScopeRules.GetDebugInfo <DebugDataScopeRules>(parentDepth, childDepth);

                if (Region.RepeatType != null)
                {
                    if (debugDataScopeRules.DataSupplies == null)
                    {
                        debugDataScopeRules.DataSupplies = new List <DebugSuppliedDependency>();
                    }

                    var repeatDataSupply = new DebugSuppliedDependency
                    {
                        DataTypeSupplied = new DebugDataScope
                        {
                            DataType  = Region.RepeatType,
                            ScopeName = Region.RepeatScope
                        },
                        DataSupply = new DebugDataSupply
                        {
                            Instance        = this,
                            IsStatic        = false,
                            SubscriberCount = _onSupplyActions.Count,
                            SuppliedData    = new DebugDataScope
                            {
                                DataType  = Region.RepeatType,
                                ScopeName = Region.RepeatScope
                            },
                            Supplier = new DebugDataSupplier
                            {
                                Instance = this,
                                Name     = Region.Name + " page region",
                            }
                        },
                        DataConsumer = new DebugDataConsumer
                        {
                            DependentData = new List <DebugDataScope>
                            {
                                new DebugDataScope
                                {
                                    DataType  = Region.ListType,
                                    ScopeName = Region.ListScope
                                }
                            }
                        }
                    };

                    debugDataScopeRules.DataSupplies.Add(repeatDataSupply);
                }

                return(base.PopulateDebugInfo <T>(debugDataScopeRules, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataSupplier)))
            {
                var debugDataSupplier = debugInfo as DebugDataSupplier ?? new DebugDataSupplier();

                if (Region.RepeatType != null)
                {
                    debugDataSupplier.SuppliedTypes = new List <Type> {
                        Region.RepeatType
                    };
                    debugDataSupplier.DefaultSupply = new DebugDataScope
                    {
                        DataType  = Region.RepeatType,
                        ScopeName = Region.RepeatScope
                    };
                }

                return(base.PopulateDebugInfo <T>(debugDataSupplier, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataSupply)))
            {
                var debugDataSupply = debugInfo as DebugDataSupply ?? new DebugDataSupply();

                lock (_onSupplyActions) debugDataSupply.SubscriberCount = _onSupplyActions.Count;
                debugDataSupply.IsStatic = false;

                var region = Element as IRegion;
                if (region != null)
                {
                    debugDataSupply.SuppliedData = new DebugDataScope
                    {
                        DataType  = region.RepeatType,
                        ScopeName = region.RepeatScope
                    };
                }

                return(base.PopulateDebugInfo <T>(debugDataSupply, parentDepth, childDepth));
            }

            return(base.PopulateDebugInfo <T>(debugInfo, parentDepth, childDepth));
        }
Esempio n. 3
0
        protected override T PopulateDebugInfo <T>(DebugInfo debugInfo, int parentDepth, int childDepth)
        {
            if (typeof(T).IsAssignableFrom(typeof(DebugRegion)))
            {
                var debugRegion = debugInfo as DebugRegion ?? new DebugRegion();

                if (childDepth != 0)
                {
                    var content = Content as IDebuggable;
                    if (content != null)
                    {
                        debugRegion.Children = new List <DebugInfo> {
                            content.GetDebugInfo(0, childDepth - 1)
                        }
                    }
                    ;
                }

                debugRegion.RepeatScope = RepeatScope;
                debugRegion.RepeatType  = _repeatType;
                debugRegion.ListType    = _listType;
                debugRegion.ListScope   = ListScope;

                if (_dataScopeRules != null)
                {
                    debugRegion.Scope = _dataScopeRules.GetDebugInfo <DebugDataScopeRules>();
                }

                return(base.PopulateDebugInfo <T>(debugRegion, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataScopeRules)))
            {
                var debugDataScopeRules = _dataScopeRules.GetDebugInfo <DebugDataScopeRules>(parentDepth, childDepth);

                if (RepeatType != null)
                {
                    if (debugDataScopeRules.DataSupplies == null)
                    {
                        debugDataScopeRules.DataSupplies = new List <DebugSuppliedDependency>();
                    }

                    var repeatDataSupply = new DebugSuppliedDependency
                    {
                        DataTypeSupplied = new DebugDataScope
                        {
                            DataType  = RepeatType,
                            ScopeName = RepeatScope
                        },
                        DataConsumer = new DebugDataConsumer
                        {
                            DependentData = new List <DebugDataScope>
                            {
                                new DebugDataScope
                                {
                                    DataType  = ListType,
                                    ScopeName = ListScope
                                }
                            }
                        }
                    };

                    debugDataScopeRules.DataSupplies.Add(repeatDataSupply);
                }

                return(base.PopulateDebugInfo <T>(debugDataScopeRules, parentDepth, childDepth));
            }

            if (typeof(T).IsAssignableFrom(typeof(DebugDataSupplier)))
            {
                var debugDataSupplier = debugInfo as DebugDataSupplier ?? new DebugDataSupplier();

                if (RepeatType != null)
                {
                    debugDataSupplier.SuppliedTypes = new List <Type> {
                        RepeatType
                    };
                    debugDataSupplier.DefaultSupply = new DebugDataScope
                    {
                        DataType  = RepeatType,
                        ScopeName = RepeatScope
                    };
                }

                return(base.PopulateDebugInfo <T>(debugDataSupplier, parentDepth, childDepth));
            }

            return(base.PopulateDebugInfo <T>(debugInfo, parentDepth, childDepth));
        }