public RazorHost(IExecutionContext executionContext, IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver resolver, IBasePageTypeProvider basePageTypeProvider) : base(chunkTreeCache, resolver) { DefaultBaseClass = basePageTypeProvider.BasePageType.FullName; DefaultInheritedChunks.OfType <SetBaseTypeChunk>().First().TypeName = DefaultBaseClass; // The chunk is actually what injects the base name into the view EnableInstrumentation = false; // Add additional default namespaces from the execution context foreach (string ns in executionContext.Namespaces) { NamespaceImports.Add(ns); } }
public RazorHost(IExecutionContext executionContext, IChunkTreeCache chunkTreeCache, ITagHelperDescriptorResolver resolver, IBasePageTypeProvider basePageTypeProvider) : base(chunkTreeCache, resolver) { // Remove the backtick from generic class names string baseClassName = basePageTypeProvider.BasePageType.FullName; int tickIndex = baseClassName.IndexOf('`'); if (tickIndex > 0) { baseClassName = baseClassName.Substring(0, tickIndex); } DefaultBaseClass = basePageTypeProvider.BasePageType.IsGenericTypeDefinition ? $"{baseClassName}<{ChunkHelper.TModelToken}>" : baseClassName; DefaultInheritedChunks.OfType <SetBaseTypeChunk>().First().TypeName = DefaultBaseClass; // The chunk is actually what injects the base name into the view EnableInstrumentation = false; // Add additional default namespaces from the execution context foreach (string ns in executionContext.Namespaces) { NamespaceImports.Add(ns); } }