Exemplo n.º 1
0
 public ConstructorInjection(IDependency[] dependencies)
 {
     Dependencies = dependencies;
     refMgr       = ReferenceManager.Instance;
     if (dependencies != null && dependencies.Length > 0)
     {
         foreach (var item in dependencies)
         {
             item.OnRefresh += OnFresh;
             if (!item.HasDependencied)
             {
                 IsMatch = false;
             }
         }
     }
 }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        public ConstructorInjection(IDependency[] dependencies)
        {

            Dependencies = dependencies;
            refMgr = ReferenceManager.Instance;
            if (dependencies != null && dependencies.Length > 0)
            {
                foreach (var item in dependencies)
                {
                    item.OnRefresh += OnFresh;
                    if (!item.HasDependencied)
                        IsMatch = false;
                }
            }
        }