// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.Mvc.Razor.Compilation; using Microsoft.CodeAnalysis.CSharp; namespace Microsoft.AspNet.Mvc.Razor { /// /// Provides programmatic configuration for the . /// public class RazorViewEngineOptions { private CSharpParseOptions _parseOptions = new CSharpParseOptions(LanguageVersion.CSharp6); private CSharpCompilationOptions _compilationOptions = new CSharpCompilationOptions(CodeAnalysis.OutputKind.DynamicallyLinkedLibrary); private Action _compilationCallback = c => { }; /// /// Get a used by the . /// public IList ViewLocationExpanders { get; } = new List(); /// /// Gets the sequence of instances used by to /// locate Razor files. /// /// /// At startup, this is initialized to include an instance of that is /// rooted at the application root. /// public IList FileProviders { get; } = new List(); /// /// Gets or sets the callback that is used to customize Razor compilation /// to change compilation settings you can update property. /// /// /// Customizations made here would not reflect in tooling (Intellisense). /// public Action CompilationCallback { get { return _compilationCallback; } set { if (value == null) { throw new ArgumentNullException(nameof(value)); } _compilationCallback = value; } } /// /// Gets or sets the options used by Razor view compilation. /// public CSharpParseOptions ParseOptions { get { return _parseOptions; } set { if (value == null) { throw new ArgumentNullException(nameof(value)); } _parseOptions = value; } } /// /// Gets or sets the used by Razor view compilation. /// public CSharpCompilationOptions CompilationOptions { get { return _compilationOptions; } set { if (value == null) { throw new ArgumentNullException(nameof(value)); } _compilationOptions = value; } } } }