public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement) { IExpressionStatement parentExpression = GetParentExpressionStatemenmt(registrationRootElement); if (parentExpression == null) { yield break; } IStructuralMatchResult match = Match(registrationRootElement); if (match.Matched) { var arguments = match.GetMatchedElementList("assemblies").Cast<ICSharpArgument>(); IEnumerable<IModule> modules = arguments.SelectNotNull(argument => ModuleExtractor.GetTargetModule(argument.Value)); foreach (IModule module in modules) { var registration = new ModuleBasedOnRegistration(module, new DefaultScanAssemblyRegistration(registrationRootElement)); var basedOnRegistrations = BasedOnPatterns.SelectMany( basedOnPattern => basedOnPattern.GetBasedOnRegistrations(parentExpression.Expression)); yield return new CompositeRegistration(registrationRootElement, registration, basedOnRegistrations.ToArray()); } } }
public CompositeRegistration(ITreeNode registrationElement, ModuleBasedOnRegistration moduleBasedOnRegistration, IEnumerable<BasedOnRegistrationBase> basedOnRegistrations) : base(registrationElement) { this.moduleBasedOnRegistration = moduleBasedOnRegistration; this.basedOnRegistrations = basedOnRegistrations; }