public AutoServiceInstanceIdentificationList(IEnumerable <IInstanceIdentification> existingIdentifications)
        {
            IEnumerator <IInstanceIdentification> iterator = existingIdentifications.GetEnumerator();

            IInstanceIdentification currentIdentification = null;

            using (iterator)
            {
                while (iterator.MoveNext())
                {
                    currentIdentification = iterator.Current;

                    if (currentIdentification.IdentificationType == InstanceIdenfiticationTypeEnum.Auto)
                    {
                        this.Add(currentIdentification as IAutoServiceInstanceIdentification);
                    }
                }
            }
        }
Beispiel #2
0
        public static TServiceGroupItem Get <TServiceGroup, TServiceGroupItem>(IServiceContainer container, LifeTimeEnum lifetime = LifeTimeEnum.New)
            where TServiceGroup : class
            where TServiceGroupItem : class, TServiceGroup
        {
            AutoServiceGroupItemInstanceIdentificationList foundIdentifiers =
                new AutoServiceGroupItemInstanceIdentificationList(container.GetAllInstances <IInstanceIdentification>());

            if (foundIdentifiers.Count == 0)
            {
                return(null);
            }

            IInstanceIdentification foundIdentifier = foundIdentifiers.FindByService <TServiceGroup, TServiceGroupItem>(lifetime);

            if (foundIdentifier != null)
            {
                return(container.GetInstance <TServiceGroup>(foundIdentifier.GetTypeId()) as TServiceGroupItem);
            }

            return(null);
        }
Beispiel #3
0
 public LFW(Func <TResult> factory, IInstanceIdentification instanceIdentifier)
 {
     this._factory            = factory;
     this._instanceIdentifier = instanceIdentifier;
 }