本文整理匯總了C#中ServiceStack.Razor.Managers.RazorPage.ActivateInstance方法的典型用法代碼示例。如果您正苦於以下問題:C# RazorPage.ActivateInstance方法的具體用法?C# RazorPage.ActivateInstance怎麽用?C# RazorPage.ActivateInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ServiceStack.Razor.Managers.RazorPage
的用法示例。
在下文中一共展示了RazorPage.ActivateInstance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateRazorPageInstance
private IRazorView CreateRazorPageInstance(IHttpRequest httpReq, IHttpResponse httpRes, object dto, RazorPage razorPage)
{
EnsureCompiled(razorPage, httpRes);
//don't proceed any further, the background compiler found there was a problem compiling the page, so throw instead
if (razorPage.CompileException != null)
{
throw razorPage.CompileException;
}
//else, EnsureCompiled() ensures we have a page type to work with so, create an instance of the page
var page = (IRazorView) razorPage.ActivateInstance();
page.Init(viewEngine: this, httpReq: httpReq, httpRes: httpRes);
//deserialize the model.
PrepareAndSetModel(page, httpReq, dto);
return page;
}
示例2: CreateRazorPageInstance
private IRazorView CreateRazorPageInstance(IRequest httpReq, IResponse httpRes, object dto, RazorPage razorPage)
{
viewManager.EnsureCompiled(razorPage);
//don't proceed any further, the background compiler found there was a problem compiling the page, so throw instead
if (razorPage.CompileException != null)
{
if (Text.Env.IsMono)
{
//Additional debug info Working around not displaying default exception in IHttpAsyncHandler
var errors = razorPage.CompileException.Results.Errors;
for (var i = 0; i < errors.Count; i++)
{
var error = errors[i];
Log.Debug("{0} Line: {1}:{2}:".Fmt(error.FileName, error.Line, error.Column));
Log.Debug("{0}: {1}".Fmt(error.ErrorNumber, error.ErrorText));
}
}
throw razorPage.CompileException;
}
//else, EnsureCompiled() ensures we have a page type to work with so, create an instance of the page
var page = (IRazorView)razorPage.ActivateInstance();
page.Init(viewEngine: this, httpReq: httpReq, httpRes: httpRes);
//deserialize the model.
PrepareAndSetModel(page, httpReq, dto);
return page;
}