Пример #1
0
        public LegacyTemplateEngineFactoryService([Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _workspace = workspace;
            _inner     = workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService <Inner>();
        }
Пример #2
0
        // internal for testing
        internal LegacyTemplateEngineFactoryService(Workspace workspace, Inner inner)
        {
            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            if (inner == null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            _workspace = workspace;
            _inner     = inner;
        }
        public DefaultVisualStudioRazorParserFactory(
            ICompletionBroker completionBroker,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _completionBroker = completionBroker;
            _dispatcher       = workspace.Services.GetRequiredService <ForegroundDispatcher>();
            _errorReporter    = workspace.Services.GetRequiredService <ErrorReporter>();
            var razorLanguageServices = workspace.Services.GetLanguageServices(RazorLanguage.Name);

            _templateEngineFactoryService = razorLanguageServices.GetRequiredService <TemplateEngineFactoryService>();
        }