Remove IMvcRazorHost.MainClassPrefix

This commit is contained in:
Pranav K 2016-03-03 16:53:55 -08:00
parent 5612ca845f
commit 501547d630
19 changed files with 57 additions and 74 deletions

View File

@ -22,11 +22,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor
/// </returns>
GeneratorResults GenerateCode(string rootRelativePath, Stream inputStream);
/// <summary>
/// Represent the prefix off the main entry class in the view.
/// </summary>
string MainClassNamePrefix { get; }
/// <summary>
/// Represent the namespace the main entry class in the view.
/// </summary>

View File

@ -182,12 +182,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor
get { return "dynamic"; }
}
/// <inheritdoc />
public string MainClassNamePrefix
{
get { return "ASPV_"; }
}
/// <summary>
/// Gets the list of chunks that are injected by default by this host.
/// </summary>
@ -263,8 +257,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
/// <inheritdoc />
public GeneratorResults GenerateCode(string rootRelativePath, Stream inputStream)
{
// Adding a prefix so that the main view class can be easily identified.
var className = MainClassNamePrefix + ParserHelpers.SanitizeClassName(rootRelativePath);
var className = ParserHelpers.SanitizeClassName(rootRelativePath);
var engine = new RazorTemplateEngine(this);
return engine.GenerateCode(inputStream, className, DefaultNamespace, rootRelativePath);
}

View File

@ -39,7 +39,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
private readonly IApplicationEnvironment _environment;
private readonly IFileProvider _fileProvider;
private readonly Lazy<List<MetadataReference>> _applicationReferences;
private readonly string _classPrefix;
private readonly Action<RoslynCompilationContext> _compilationCallback;
private readonly CSharpParseOptions _parseOptions;
private readonly CSharpCompilationOptions _compilationOptions;
@ -54,13 +53,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
/// Initalizes a new instance of the <see cref="DefaultRoslynCompilationService"/> class.
/// </summary>
/// <param name="environment">The environment for the executing application.</param>
/// <param name="host">The <see cref="IMvcRazorHost"/> that was used to generate the code.</param>
/// <param name="optionsAccessor">Accessor to <see cref="RazorViewEngineOptions"/>.</param>
/// <param name="fileProviderAccessor">The <see cref="IRazorViewEngineFileProviderAccessor"/>.</param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
public DefaultRoslynCompilationService(
IApplicationEnvironment environment,
IMvcRazorHost host,
IOptions<RazorViewEngineOptions> optionsAccessor,
IRazorViewEngineFileProviderAccessor fileProviderAccessor,
ILoggerFactory loggerFactory)
@ -68,7 +65,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
_environment = environment;
_applicationReferences = new Lazy<List<MetadataReference>>(GetApplicationReferences);
_fileProvider = fileProviderAccessor.FileProvider;
_classPrefix = host.MainClassNamePrefix;
_compilationCallback = optionsAccessor.Value.CompilationCallback;
_parseOptions = optionsAccessor.Value.ParseOptions;
_compilationOptions = optionsAccessor.Value.CompilationOptions;
@ -158,10 +154,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
assembly = LoadStream(ms, assemblySymbols: null);
}
var type = assembly
.GetExportedTypes()
.First(t => t.Name.StartsWith(_classPrefix, StringComparison.Ordinal));
var type = assembly.GetExportedTypes().FirstOrDefault(a => !a.IsNested);
_logger.GeneratedCodeToAssemblyCompilationEnd(fileInfo.RelativePath, startTimestamp);
return new CompilationResult(type);

View File

@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 33,
documentLineIndex: 2,
documentCharacterIndex: 14,
generatedAbsoluteIndex: 602,
generatedAbsoluteIndex: 597,
generatedLineIndex: 16,
generatedCharacterIndex: 48,
contentLength: 91),
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 7,
documentLineIndex: 0,
documentCharacterIndex: 7,
generatedAbsoluteIndex: 784,
generatedAbsoluteIndex: 779,
generatedLineIndex: 18,
generatedCharacterIndex: 28,
contentLength: 8),
@ -154,7 +154,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 145,
documentLineIndex: 4,
documentCharacterIndex: 17,
generatedAbsoluteIndex: 2252,
generatedAbsoluteIndex: 2242,
generatedLineIndex: 47,
generatedCharacterIndex: 99,
contentLength: 3),
@ -162,7 +162,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 172,
documentLineIndex: 5,
documentCharacterIndex: 18,
generatedAbsoluteIndex: 2585,
generatedAbsoluteIndex: 2575,
generatedLineIndex: 53,
generatedCharacterIndex: 91,
contentLength: 5),
@ -212,7 +212,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 13,
documentLineIndex: 0,
documentCharacterIndex: 13,
generatedAbsoluteIndex: 1305,
generatedAbsoluteIndex: 1295,
generatedLineIndex: 32,
generatedCharacterIndex: 13,
contentLength: 4),
@ -220,7 +220,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 43,
documentLineIndex: 2,
documentCharacterIndex: 5,
generatedAbsoluteIndex: 1389,
generatedAbsoluteIndex: 1379,
generatedLineIndex: 37,
generatedCharacterIndex: 6,
contentLength: 21),
@ -248,7 +248,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 8,
documentLineIndex: 0,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 669,
generatedAbsoluteIndex: 659,
generatedLineIndex: 21,
generatedCharacterIndex: 8,
contentLength: 26),
@ -284,7 +284,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 28,
documentLineIndex: 1,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 714,
generatedAbsoluteIndex: 704,
generatedLineIndex: 26,
generatedCharacterIndex: 8,
contentLength: 20),
@ -312,7 +312,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 7,
documentLineIndex: 0,
documentCharacterIndex: 7,
generatedAbsoluteIndex: 395,
generatedAbsoluteIndex: 390,
generatedLineIndex: 11,
generatedCharacterIndex: 28,
contentLength: 7),
@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 24,
documentLineIndex: 1,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 763,
generatedAbsoluteIndex: 753,
generatedLineIndex: 25,
generatedCharacterIndex: 8,
contentLength: 20),
@ -328,7 +328,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 54,
documentLineIndex: 2,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 993,
generatedAbsoluteIndex: 983,
generatedLineIndex: 33,
generatedCharacterIndex: 8,
contentLength: 23),
@ -356,7 +356,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 7,
documentLineIndex: 0,
documentCharacterIndex: 7,
generatedAbsoluteIndex: 403,
generatedAbsoluteIndex: 398,
generatedLineIndex: 11,
generatedCharacterIndex: 28,
contentLength: 7),
@ -364,7 +364,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 24,
documentLineIndex: 1,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 779,
generatedAbsoluteIndex: 769,
generatedLineIndex: 25,
generatedCharacterIndex: 8,
contentLength: 20),
@ -372,7 +372,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 58,
documentLineIndex: 2,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 1013,
generatedAbsoluteIndex: 1003,
generatedLineIndex: 33,
generatedCharacterIndex: 8,
contentLength: 23),
@ -380,7 +380,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 93,
documentLineIndex: 3,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 1250,
generatedAbsoluteIndex: 1240,
generatedLineIndex: 41,
generatedCharacterIndex: 8,
contentLength: 21),
@ -388,7 +388,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 129,
documentLineIndex: 4,
documentCharacterIndex: 8,
generatedAbsoluteIndex: 1485,
generatedAbsoluteIndex: 1475,
generatedLineIndex: 49,
generatedCharacterIndex: 8,
contentLength: 24),
@ -416,7 +416,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
documentAbsoluteIndex: 7,
documentLineIndex: 0,
documentCharacterIndex: 7,
generatedAbsoluteIndex: 398,
generatedAbsoluteIndex: 393,
generatedLineIndex: 11,
generatedCharacterIndex: 28,
contentLength: 30),
@ -559,12 +559,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor
int generatedCharacterIndex,
int contentLength)
{
var documentLocation = new SourceLocation(documentAbsoluteIndex,
documentLineIndex,
documentCharacterIndex);
var generatedLocation = new SourceLocation(generatedAbsoluteIndex,
generatedLineIndex,
generatedCharacterIndex);
var documentLocation = new SourceLocation(
documentAbsoluteIndex,
documentLineIndex,
documentCharacterIndex);
var generatedLocation = new SourceLocation(
generatedAbsoluteIndex,
generatedLineIndex,
generatedCharacterIndex);
return new LineMapping(
documentLocation: new MappingLocation(documentLocation, contentLength),

View File

@ -2,7 +2,7 @@ namespace Asp
{
using System.Threading.Tasks;
public class ASPV_testfiles_input_basic_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class testfiles_input_basic_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -11,7 +11,7 @@ namespace Asp
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input_basic_cshtml()
public testfiles_input_basic_cshtml()
{
}
#line hidden

View File

@ -8,7 +8,7 @@ using MyNamespace
;
using System.Threading.Tasks;
public class ASPV_testfiles_input_inject_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class testfiles_input_inject_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -17,7 +17,7 @@ using MyNamespace
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input_inject_cshtml()
public testfiles_input_inject_cshtml()
{
}
#line hidden

View File

@ -2,7 +2,7 @@ namespace Asp
{
using System.Threading.Tasks;
public class ASPV_testfiles_input_injectwithmodel_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
public class testfiles_input_injectwithmodel_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -16,7 +16,7 @@ var __modelHelper = default(MyModel);
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input_injectwithmodel_cshtml()
public testfiles_input_injectwithmodel_cshtml()
{
}
#line hidden

View File

@ -2,7 +2,7 @@ namespace Asp
{
using System.Threading.Tasks;
public class ASPV_testfiles_input_injectwithsemicolon_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
public class testfiles_input_injectwithsemicolon_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -16,7 +16,7 @@ var __modelHelper = default(MyModel);
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input_injectwithsemicolon_cshtml()
public testfiles_input_injectwithsemicolon_cshtml()
{
}
#line hidden

View File

@ -2,7 +2,7 @@ namespace Asp
{
using System.Threading.Tasks;
public class ASPV_testfiles_input_model_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
public class testfiles_input_model_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -16,7 +16,7 @@ var __modelHelper = default(System.Collections.IEnumerable);
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input_model_cshtml()
public testfiles_input_model_cshtml()
{
}
#line hidden

View File

@ -7,7 +7,7 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_testfiles_input_modelexpressiontaghelper_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
public class testfiles_input_modelexpressiontaghelper_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -25,7 +25,7 @@ var __modelHelper = default(DateTime);
#line hidden
private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = null;
#line hidden
public ASPV_testfiles_input_modelexpressiontaghelper_cshtml()
public testfiles_input_modelexpressiontaghelper_cshtml()
{
}
#line hidden

View File

@ -2,7 +2,7 @@ namespace Asp
{
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_MultipleModels_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
public class TestFiles_Input_MultipleModels_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -16,7 +16,7 @@ var __modelHelper = default(System.Collections.IEnumerable);
#pragma warning restore 219
}
#line hidden
public ASPV_TestFiles_Input_MultipleModels_cshtml()
public TestFiles_Input_MultipleModels_cshtml()
{
}
#line hidden

View File

@ -3,7 +3,7 @@ namespace Asp
using System.Threading.Tasks;
using TModel = System.Object;
public class ASPV_testfiles_input__viewimports_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class testfiles_input__viewimports_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
@ -12,7 +12,7 @@ namespace Asp
#pragma warning restore 219
}
#line hidden
public ASPV_testfiles_input__viewimports_cshtml()
public testfiles_input__viewimports_cshtml()
{
}
#line hidden

View File

@ -8,10 +8,10 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_Basic_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class TestFiles_Input_Basic_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#line hidden
public ASPV_TestFiles_Input_Basic_cshtml()
public TestFiles_Input_Basic_cshtml()
{
}
#line hidden

View File

@ -14,10 +14,10 @@ using MyNamespace
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_Inject_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class TestFiles_Input_Inject_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#line hidden
public ASPV_TestFiles_Input_Inject_cshtml()
public TestFiles_Input_Inject_cshtml()
{
}
#line hidden

View File

@ -8,10 +8,10 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
public class TestFiles_Input_InjectWithModel_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
#line hidden
public ASPV_TestFiles_Input_InjectWithModel_cshtml()
public TestFiles_Input_InjectWithModel_cshtml()
{
}
#line hidden

View File

@ -8,10 +8,10 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
public class TestFiles_Input_InjectWithSemicolon_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<MyModel>
{
#line hidden
public ASPV_TestFiles_Input_InjectWithSemicolon_cshtml()
public TestFiles_Input_InjectWithSemicolon_cshtml()
{
}
#line hidden

View File

@ -8,10 +8,10 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_Model_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
public class TestFiles_Input_Model_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<System.Collections.IEnumerable>
{
#line hidden
public ASPV_TestFiles_Input_Model_cshtml()
public TestFiles_Input_Model_cshtml()
{
}
#line hidden

View File

@ -8,7 +8,7 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
public class TestFiles_Input_ModelExpressionTagHelper_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<DateTime>
{
#line hidden
#pragma warning disable 0414
@ -19,7 +19,7 @@ namespace Asp
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager();
private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = null;
#line hidden
public ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml()
public TestFiles_Input_ModelExpressionTagHelper_cshtml()
{
}
#line hidden

View File

@ -8,10 +8,10 @@ namespace Asp
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Threading.Tasks;
public class ASPV_TestFiles_Input__ViewImports_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
public class TestFiles_Input__ViewImports_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#line hidden
public ASPV_TestFiles_Input__ViewImports_cshtml()
public TestFiles_Input__ViewImports_cshtml()
{
}
#line hidden