Пример #1
0
 internal static CompositeBuilder CreateBuilder( CompositeModelTypeInstanceScopeSupport modelSupport, CompositeInstanceStructureOwner structureOwner, CompositeModelType compositeModelType, IEnumerable<Type> compositeTypes )
 {
    var compositeTypesArr = compositeTypes.ToArray();
    var tuple = ( (ModuleImpl) structureOwner ).FindModelForBuilder( compositeModelType, compositeTypesArr );
    var uses = UsesContainerMutableImpl.CreateWithParent( tuple.Item2.UsesContainer );
    return new CompositeBuilderImpl( compositeTypesArr, uses, (CompositeInstanceImpl) modelSupport.CreateInstance( tuple.Item1, tuple.Item2, compositeTypesArr, uses.Query ) );
 }
        protected IEnumerable <ServiceReference> FindServicesImpl(Type[] serviceTypes)
        {
            CompositeModelTypeInstanceScopeSupport support = this._modelSupport[CompositeModelType.SERVICE];

            return(this._modelFinder(model => CompositeModelType.SERVICE.Equals(model.ModelType) && serviceTypes.All(sType => model.PublicTypes.Any(pType => sType.IsAssignableFrom(pType))))
                   .Select(tuple => new ServiceReferenceImpl((ServiceCompositeModel)tuple.Item2, () => (ServiceCompositeInstanceImpl)support.CreateInstance(tuple.Item1, tuple.Item2, serviceTypes, null), this._structure.Application /*, serviceTypes */)
                           ));
        }