コード例 #1
0
        private void addApplication(IEventGroupBuilder protocolGroupBuilder, ISchemaItem schemaItem, string applicationName, CompoundProperties compoundProperties, Protocol protocol)
        {
            IContainer applicationParentContainer;
            string     formulationType;

            IEnumerable <IParameter> formulationParameters;

            if (schemaItem.NeedsFormulation)
            {
                var formulation = _formulationFromMappingRetriever.FormulationUsedBy(_simulation, compoundProperties.ProtocolProperties.MappingWith(schemaItem.FormulationKey));
                if (formulation == null)
                {
                    throw new NoFormulationFoundForRouteException(protocol, schemaItem.ApplicationType);
                }

                //check if used formulation container is already created and create if needed
                if (protocolGroupBuilder.ContainsName(formulation.Name))
                {
                    applicationParentContainer = protocolGroupBuilder.GetSingleChildByName <IEventGroupBuilder>(formulation.Name);
                }
                else
                {
                    applicationParentContainer = createFormulationAsEventGroupBuilderFrom(formulation);
                }

                protocolGroupBuilder.Add(applicationParentContainer);
                formulationType = formulation.FormulationType;

                formulationParameters = applicationParentContainer.GetChildren <IParameter>();
            }
            else
            {
                applicationParentContainer = protocolGroupBuilder;
                formulationType            = CoreConstants.Formulation.EmptyFormulation;
                formulationParameters      = new List <IParameter>();
            }

            applicationParentContainer.Add(
                _applicationFactory.CreateFor(schemaItem, formulationType, applicationName, compoundProperties.Compound.Name, formulationParameters, _eventGroupBuildingBlock.FormulaCache));
        }
コード例 #2
0
 public static IEventGroupBuilder MainSubContainer(this IEventGroupBuilder eventGroupBuilder)
 {
     return(eventGroupBuilder.GetSingleChildByName <IEventGroupBuilder>(CoreConstants.ContainerName.EventGroupMainSubContainer));
 }