public static void Add <T>(this OrderPrecedenceExportFactoryCollection <T> collection, T value, string appliesTo = null, int orderPrecedence = 0) { var metadata = IOrderPrecedenceMetadataViewFactory.Create(appliesTo, orderPrecedence); var factory = ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => value, metadata); collection.Add(factory); }
private WorkspaceProjectContextHostInstance CreateInstance(ConfiguredProject project = null, IProjectThreadingService threadingService = null, IUnconfiguredProjectTasksService tasksService = null, IProjectSubscriptionService projectSubscriptionService = null, IActiveEditorContextTracker activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext applyChangesToWorkspaceContext = null) { project = project ?? ConfiguredProjectFactory.Create(); threadingService = threadingService ?? IProjectThreadingServiceFactory.Create(); tasksService = tasksService ?? IUnconfiguredProjectTasksServiceFactory.Create(); projectSubscriptionService = projectSubscriptionService ?? IProjectSubscriptionServiceFactory.Create(); activeWorkspaceProjectContextTracker = activeWorkspaceProjectContextTracker ?? IActiveEditorContextTrackerFactory.Create(); workspaceProjectContextProvider = workspaceProjectContextProvider ?? IWorkspaceProjectContextProviderFactory.ImplementCreateProjectContextAsync(IWorkspaceProjectContextAccessorFactory.Create()); applyChangesToWorkspaceContext = applyChangesToWorkspaceContext ?? IApplyChangesToWorkspaceContextFactory.Create(); return(new WorkspaceProjectContextHostInstance(project, threadingService, tasksService, projectSubscriptionService, workspaceProjectContextProvider, activeWorkspaceProjectContextTracker, ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => applyChangesToWorkspaceContext))); }
private static WorkspaceProjectContextHostInstance CreateInstance(ConfiguredProject?project = null, IProjectThreadingService?threadingService = null, IUnconfiguredProjectTasksService?tasksService = null, IProjectSubscriptionService?projectSubscriptionService = null, IActiveEditorContextTracker?activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider?workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext?applyChangesToWorkspaceContext = null) { project ??= ConfiguredProjectFactory.Create(); threadingService ??= IProjectThreadingServiceFactory.Create(); tasksService ??= IUnconfiguredProjectTasksServiceFactory.Create(); projectSubscriptionService ??= IProjectSubscriptionServiceFactory.Create(); activeWorkspaceProjectContextTracker ??= IActiveEditorContextTrackerFactory.Create(); workspaceProjectContextProvider ??= IWorkspaceProjectContextProviderFactory.ImplementCreateProjectContextAsync(IWorkspaceProjectContextAccessorFactory.Create()); applyChangesToWorkspaceContext ??= IApplyChangesToWorkspaceContextFactory.Create(); IDataProgressTrackerService dataProgressTrackerService = IDataProgressTrackerServiceFactory.Create(); return(new WorkspaceProjectContextHostInstance(project, threadingService, tasksService, projectSubscriptionService, workspaceProjectContextProvider, activeWorkspaceProjectContextTracker, ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => applyChangesToWorkspaceContext), dataProgressTrackerService)); }
private static ApplyChangesToWorkspaceContext CreateInstance(ConfiguredProject?project = null, ICommandLineParserService?commandLineParser = null, IProjectLogger?logger = null, params IWorkspaceContextHandler[] handlers) { if (project == null) { var unconfiguredProject = UnconfiguredProjectFactory.ImplementFullPath(@"C:\Project\Project.csproj"); project = ConfiguredProjectFactory.ImplementUnconfiguredProject(unconfiguredProject); } commandLineParser ??= ICommandLineParserServiceFactory.Create(); logger ??= IProjectLoggerFactory.Create(); var factories = handlers.Select(h => ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => h)) .ToArray(); var applyChangesToWorkspaceContext = new ApplyChangesToWorkspaceContext(project, logger, factories); applyChangesToWorkspaceContext.CommandLineParsers.Add(commandLineParser); return(applyChangesToWorkspaceContext); }