示例#1
0
        private void PopulateCollectionLazyValue(List <object> references, ICollectonLazy collectionLazy)
        {
            Action <object> onValueCreated = null;

            onValueCreated = o =>
            {
                var values = (o as IEnumerable).Cast <object>().ToArray();
                var length = values.Length;
                for (int i = 0; i < length; i++)
                {
                    refMgr.RegisterHandle(values[i], collectionLazy.Kernels[i], collectionLazy.Components[i]);
                    references.Add(values[i]);
                }
                collectionLazy.ValueCreated -= onValueCreated;
            };
            collectionLazy.ValueCreated += onValueCreated;
        }
示例#2
0
        public static void RegisterCollectionLazyAndReferred(this ICollectonLazy collectionLazy, object owner)
        {
            Action <object> onValueCreated = null;

            onValueCreated = o =>
            {
                var values = (o as IEnumerable).Cast <object>().ToArray();
                var length = values.Length;
                ReferenceManager refMgr = ReferenceManager.Instance;
                for (int i = 0; i < length; i++)
                {
                    refMgr.RegisterHandle(values[i], collectionLazy.Kernels[i], collectionLazy.Components[i]);
                    refMgr.RegisterReference(owner, values[i]);
                }
                collectionLazy.ValueCreated -= onValueCreated;
            };
            collectionLazy.ValueCreated += onValueCreated;
        }
示例#3
0
 private void PopulateCollectionLazyValue(List<object> references, ICollectonLazy collectionLazy)
 {
     Action<object> onValueCreated = null;
     onValueCreated = o =>
     {
         var values = (o as IEnumerable).Cast<object>().ToArray();
         var length = values.Length;
         for (int i = 0; i < length; i++)
         {
             refMgr.RegisterHandle(values[i], collectionLazy.Kernels[i], collectionLazy.Components[i]);
             references.Add(values[i]);
         }
         collectionLazy.ValueCreated -= onValueCreated;
     };
     collectionLazy.ValueCreated += onValueCreated;
 }