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)); IEnumerable <FilteredRegistrationBase> basedOnRegistrations = basedOnPatterns.SelectMany( basedOnPattern => basedOnPattern.GetBasedOnRegistrations(parentExpression.Expression)).ToList(); foreach (IModule module in modules) { // todo blech, fix this yield return(new CompositeRegistration(registrationRootElement, basedOnRegistrations.Union( new ComponentRegistrationBase[] { new DefaultScanAssemblyRegistration(registrationRootElement), new ModuleBasedOnRegistration(registrationRootElement, module) }))); } } }
protected override IModule GetTargetModule(IStructuralMatchResult match) { return(ModuleExtractor.GetTargetModule(match.GetMatchedType("type"))); }
protected override IModule GetTargetModule(IStructuralMatchResult match) { var argument = (ICSharpArgument)match.GetMatchedElement("assemblyName"); return(ModuleExtractor.GetTargetModule(argument.Value)); }