本文整理汇总了C#中IViewEngine类的典型用法代码示例。如果您正苦于以下问题:C# IViewEngine类的具体用法?C# IViewEngine怎么用?C# IViewEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IViewEngine类属于命名空间,在下文中一共展示了IViewEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
/// <summary>
/// Add a engine.
/// </summary>
/// <param name="engine">Engine to add</param>
/// <exception cref="ArgumentNullException"><c>engine</c> is null.</exception>
public void Add(IViewEngine engine)
{
if (engine == null)
throw new ArgumentNullException("engine");
_viewEngines.Add(engine.FileExtension, engine);
}
示例2: CreateViewEngineStartupContext
private ViewEngineStartupContext CreateViewEngineStartupContext(IViewEngine viewEngine)
{
return new ViewEngineStartupContext(
this.viewCache,
this.viewLocationCache,
viewEngine.Extensions);
}
示例3: NVelocityViewContextAdapter
/// <summary>
/// Initializes a new instance of the <see cref="NVelocityViewContextAdapter"/> class.
/// </summary>
/// <param name="componentName">Name of the component.</param>
/// <param name="parentNode">The parent node.</param>
/// <param name="viewEngine">The view engine.</param>
/// <param name="renderer">The view renderer.</param>
public NVelocityViewContextAdapter(String componentName, INode parentNode, IViewEngine viewEngine, IViewRenderer renderer)
{
this.componentName = componentName;
this.parentNode = parentNode;
this.viewEngine = viewEngine;
this.renderer = renderer;
}
示例4: ViewViewComponentResult
public ViewViewComponentResult([NotNull] IViewEngine viewEngine, string viewName,
ViewDataDictionary viewData)
{
_viewEngine = viewEngine;
ViewName = viewName;
ViewData = viewData;
}
示例5: CreateContent
public StreamContent CreateContent(IViewEngine viewEngine)
{
var memoryStream = new MemoryStream();
WriteToStream(memoryStream, viewEngine);
memoryStream.Position = 0;
return new StreamContent(memoryStream);
}
示例6: TemplateRenderer
public TemplateRenderer(
IViewEngine viewEngine,
ViewContext viewContext,
ViewDataDictionary viewData,
string templateName,
bool readOnly)
{
if (viewEngine == null)
{
throw new ArgumentNullException(nameof(viewEngine));
}
if (viewContext == null)
{
throw new ArgumentNullException(nameof(viewContext));
}
if (viewData == null)
{
throw new ArgumentNullException(nameof(viewData));
}
_viewEngine = viewEngine;
_viewContext = viewContext;
_viewData = viewData;
_templateName = templateName;
_readOnly = readOnly;
}
示例7: ConfigureRegistrar
void ConfigureRegistrar(IViewEngine engine, IViewProcessor processor)
{
var r = new ViewRegistrar(processor, engine);
r.Add(new ReflectionViewRegistrar());
_registrar = r;
}
示例8: WriteToStream
private async Task WriteToStream(Stream outputStream, IViewEngine viewEngine, IPageViewDefinition viewDefinition)
{
using (var writer = new StreamWriter(outputStream))
{
SourceLocation errorLocation = null;
Exception error = null;
try
{
viewDefinition.Render(viewEngine, writer);
}
catch (VeilParserException ex)
{
error = ex;
errorLocation = ex.Location;
}
catch (VeilCompilerException ex)
{
error = ex;
errorLocation = ex.Node.Location;
}
catch (Exception ex)
{
error = ex;
}
if (error != null)
await GetErrorPage(writer, error, errorLocation).ConfigureAwait(false);
}
}
示例9: DefaultMvcHandler
public DefaultMvcHandler(IControllerFactory controllerFactory, IViewEngine viewEngine)
{
Requires.NotNull(controllerFactory, "controllerFactory");
Requires.NotNull(viewEngine, "viewEngine");
_controllerFactory = controllerFactory;
ViewEngineManager.Current.Add(viewEngine);
}
示例10: ViewEngineResult
public ViewEngineResult(IView view, IViewEngine engine)
{
Precondition.Require(view, () => Error.ArgumentNull("view"));
Precondition.Require(engine, () => Error.ArgumentNull("engine"));
_view = view;
_engine = engine;
}
示例11: ViewEngineFormatter
public ViewEngineFormatter(IViewEngine viewEngine)
{
_viewEngine = viewEngine;
foreach (var mediaTypeHeaderValue in _viewEngine.SupportedMediaTypes)
{
SupportedMediaTypes.Add(mediaTypeHeaderValue);
}
}
示例12: DefaultTerrificTemplateHandler
public DefaultTerrificTemplateHandler(IViewEngine viewEngine, IModelProvider modelProvider,
ITemplateRepository templateRepository, ILabelService labelService, IModuleRepository moduleRepository)
{
_viewEngine = viewEngine;
_modelProvider = modelProvider;
_templateRepository = templateRepository;
_labelService = labelService;
_moduleRepository = moduleRepository;
}
示例13: Setup
public void Setup(ViewEngineInspector sut, IInspectorContext context, IViewEngine viewEngine)
{
context.ProxyFactory.Setup(pf => pf.IsWrapInterfaceEligible<IViewEngine>(It.IsAny<Type>())).Returns(true);
context.ProxyFactory.Setup(pf => pf.WrapInterface(It.IsAny<IViewEngine>(), It.IsAny<IEnumerable<IAlternateMethod>>(), Enumerable.Empty<object>())).Returns(viewEngine);
sut.Setup(context);
context.ProxyFactory.Verify(pf => pf.WrapInterface(It.IsAny<IViewEngine>(), It.IsAny<IEnumerable<IAlternateMethod>>(), Enumerable.Empty<object>()), Times.AtLeastOnce());
}
示例14: CreateFactory
private DefaultViewFactory CreateFactory(params IViewEngine[] viewEngines)
{
if (viewEngines == null)
{
viewEngines = new IViewEngine[] { };
}
return new DefaultViewFactory(this.resolver, viewEngines, this.renderContextFactory, this.conventions, this.rootPathProvider);
}
示例15: Setup
public void Setup()
{
_writer = new StringWriter();
_context = new ViewContext();
_viewEngine = MockRepository.GenerateMock<IViewEngine>();
_engines = new ViewEngineCollection(new List<IViewEngine> { _viewEngine });
_context.HttpContext = MvcMockHelpers.DynamicHttpContextBase();
_renderContext = new RenderingContext(_writer, _context, _engines);
}