-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RazorProjectEngine: Don't expose EngineFeatures
This property isn't necessary. Nearly every caller can be changed to go through RazorProjectEngine.Engine.GetFeatures<T>().
- Loading branch information
1 parent
64394f2
commit c728852
Showing
9 changed files
with
21 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 6 additions & 9 deletions
15
...sis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Collections.Immutable; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Language; | ||
|
||
internal class DefaultRazorCodeGenerationOptionsFactoryProjectFeature : RazorProjectEngineFeatureBase, IRazorCodeGenerationOptionsFactoryProjectFeature | ||
{ | ||
private IConfigureRazorCodeGenerationOptionsFeature[] _configureOptions; | ||
private ImmutableArray<IConfigureRazorCodeGenerationOptionsFeature> _configureOptions; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
_configureOptions = ProjectEngine.EngineFeatures.OfType<IConfigureRazorCodeGenerationOptionsFeature>().ToArray(); | ||
_configureOptions = ProjectEngine.Engine.GetFeatures<IConfigureRazorCodeGenerationOptionsFeature>(); | ||
} | ||
|
||
public RazorCodeGenerationOptions Create(Action<RazorCodeGenerationOptionsBuilder> configure) | ||
{ | ||
var builder = new RazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration); | ||
configure?.Invoke(builder); | ||
|
||
for (var i = 0; i < _configureOptions.Length; i++) | ||
foreach (var options in _configureOptions) | ||
{ | ||
_configureOptions[i].Configure(builder); | ||
options.Configure(builder); | ||
} | ||
|
||
var options = builder.Build(); | ||
return options; | ||
return builder.Build(); | ||
} | ||
} |
15 changes: 6 additions & 9 deletions
15
...odeAnalysis.Razor.Compiler/src/Language/DefaultRazorParserOptionsFactoryProjectFeature.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Collections.Immutable; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Language; | ||
|
||
internal class DefaultRazorParserOptionsFactoryProjectFeature : RazorProjectEngineFeatureBase, IRazorParserOptionsFactoryProjectFeature | ||
{ | ||
private IConfigureRazorParserOptionsFeature[] _configureOptions; | ||
private ImmutableArray<IConfigureRazorParserOptionsFeature> _configureOptions; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
_configureOptions = ProjectEngine.EngineFeatures.OfType<IConfigureRazorParserOptionsFeature>().ToArray(); | ||
_configureOptions = ProjectEngine.Engine.GetFeatures<IConfigureRazorParserOptionsFeature>(); | ||
} | ||
|
||
public RazorParserOptions Create(string fileKind, Action<RazorParserOptionsBuilder> configure) | ||
{ | ||
var builder = new RazorParserOptionsBuilder(ProjectEngine.Configuration, fileKind); | ||
configure?.Invoke(builder); | ||
|
||
for (var i = 0; i < _configureOptions.Length; i++) | ||
foreach (var options in _configureOptions) | ||
{ | ||
_configureOptions[i].Configure(builder); | ||
options.Configure(builder); | ||
} | ||
|
||
var options = builder.Build(); | ||
return options; | ||
return builder.Build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters