Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.07 KB

obtaining_the_IThreadHandling_service.md

File metadata and controls

38 lines (25 loc) · 1.07 KB

Obtaining the IProjectThreadingService service

=====================================

From MEF via import

Note that importing any CPS related service moves your MEF part from the VS default MEF catalog into a CPS catalog "sub-scope". Import properties are only 'satisfied' when MEF activated your type (not simply by newing up an instance of your object).

    [Import]
    IProjectThreadingService ProjectThreadingService { get; set; }

From MEF via an imperative GetService query

    IProjectService projectService;
    IProjectThreadingService projectThreadingService = projectService.Services.ThreadingPolicy;

Where projectService is obtained as described in Obtaining the ProjectService.

From a loaded project

    IVsBrowseObjectContext context;
    IProjectThreadingService projectThreadingService = context.UnconfiguredProject.ProjectService.Services.ThreadingPolicy;

Where context is obtained as described in Finding CPS in a VS project.