public void ProcessCollection <T>(IReadOnlyValueDescriptor <ICollection <T> > descriptor)
        {
            int count;
            var collection = descriptor.Get();

            if (!_store.TryGet(descriptor.StateMember.Name + ".Count", out count))
            {
                return;
            }


            var temp = _store;

            for (int i = 0; i < count; i++)
            {
                var strongBox = new StrongBox <T>(default(T));

                descriptor.Route(new StrongBoxStateMember <T>(strongBox, "Item_" + i),
                                 typeof(T), strongBox, false);

                collection.Add(strongBox.Value);
            }

            _store = temp;
        }
Esempio n. 2
0
        public void ProcessCollection <T>(IReadOnlyValueDescriptor <ICollection <T> > descriptor)
        {
            int i = 0;

            var collection = descriptor.Get();

            _store.Set(descriptor.StateMember.Name + ".Count", collection.Count);

            var temp = _store;

            foreach (var item in collection)
            {
                //_store = temp.GetInner("Item_" + i);
                descriptor.Route(new StaticStateMember(item, "Item_" + i), null, false);

                i++;
            }

            _store = temp;
        }