本文整理汇总了C#中IRailsEngineContext类的典型用法代码示例。如果您正苦于以下问题:C# IRailsEngineContext类的具体用法?C# IRailsEngineContext怎么用?C# IRailsEngineContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRailsEngineContext类属于命名空间,在下文中一共展示了IRailsEngineContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InvokeNext
/// <summary>
/// Invokes the next handler.
/// </summary>
/// <param name="context">The context.</param>
protected void InvokeNext(IRailsEngineContext context)
{
if (nextHandler != null)
{
nextHandler.Process(context);
}
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:11,代码来源:AbstractExceptionHandler.cs
示例2: RenderViewFor
public void RenderViewFor(Presentation presentation, IRailsEngineContext context)
{
TabularPresentation tabularPresentation = presentation as TabularPresentation;
Controller controller = context.CurrentController;
// configuration as json output = { baseParams: {...}, tables: [...] }
Hashtable configuration = new Hashtable(2);
configuration["filters"] = CollectFilterParameters(controller.Params);
configuration["tables"] = new ArrayList();
foreach (TabularQuery table in tabularPresentation.GetQueries())
{
Hashtable tableConfig = new Hashtable();
tableConfig["url"] = controller.UrlBuilder.BuildUrl(
context.UrlInfo,
controller.Name,
"table",
DictHelper.Create("table=" + table.Id.ToString())
);
tableConfig["download"] = controller.UrlBuilder.BuildUrl(
context.UrlInfo,
controller.Name,
"download",
DictHelper.Create("table=" + table.Id.ToString())
);
tableConfig["title"] = table.Title;
tableConfig["columns"] = table.ColumnNames();
((ArrayList)configuration["tables"]).Add(tableConfig);
}
controller.PropertyBag["presentation"] = tabularPresentation;
controller.PropertyBag["configuration"] = JavaScriptConvert.SerializeObject(configuration);
controller.RenderSharedView("presentation/tables");
}
开发者ID:nbadw,项目名称:sjr_atlas,代码行数:34,代码来源:TabularPresentationViewHandler.cs
示例3: RenderMailMessage
/// <summary>
/// Renders the mail message.
/// </summary>
/// <param name="templateName">Name of the template.</param>
/// <param name="engineContext">The engine context.</param>
/// <param name="controller">The controller.</param>
/// <param name="doNotApplyLayout">if set to <c>true</c> [do not apply layout].</param>
/// <returns></returns>
public Message RenderMailMessage(string templateName, IRailsEngineContext engineContext, Controller controller,
bool doNotApplyLayout)
{
context.AddMailTemplateRendered(templateName, controller.PropertyBag);
return new Message("from", "to", "subject", "body");
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:15,代码来源:MockEmailTemplateService.cs
示例4: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
// Read previous authenticated principal from session
// (could be from cookie although with more work)
User user = (User) context.Session["user"];
// Sets the principal as the current user
context.CurrentUser = user;
// Checks if it is OK
if (context.CurrentUser == null || !context.CurrentUser.Identity.IsAuthenticated)
{
// Not authenticated, redirect to login
NameValueCollection parameters = new NameValueCollection();
parameters.Add("ReturnUrl", context.Url);
controller.Redirect("login", "index", parameters);
// Prevent request from continue
return false;
}
// Everything is ok
return true;
}
开发者ID:ralescano,项目名称:castle,代码行数:25,代码来源:AuthenticationFilter.cs
示例5: Perform
/// <summary>
/// Executa o filtro.
/// </summary>
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!Enabled)
return true;
UserAgent ua = null;
var uaString = context.UnderlyingContext.Request.UserAgent;
if (uaString != null)
{
ua = (UserAgent) cache[uaString];
if (ua == null)
cache[uaString] = ua = new UserAgent(uaString);
}
if (IsValid(ua))
return true;
if (!logged)
{
Log.Error("Tentativa de acesso através de browser não suportado: {0}", uaString);
logged = true;
}
controller.PropertyBag["invalidGecko"] = true;
if (!Redirect)
return true;
throw new Exception("redir: " + Redirect);
//RedirectToNotice(controller);
//return false;
}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:36,代码来源:MozillaOnlyFilter.cs
示例6: ItemToProcess
public ItemToProcess(WebResourceProcessor proc, string contents, IRailsEngineContext ctx, IDictionary parameters)
{
this.proc = proc;
this.contents = contents;
this.ctx = ctx;
this.parameters = parameters;
}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:7,代码来源:WebResourceProcessor.cs
示例7: CreateView
public AspViewBase CreateView(Type type, TextWriter output, IRailsEngineContext context, Controller controller)
{
ConstructorInfo constructor = (ConstructorInfo)constructors[type];
AspViewBase self = (AspViewBase)FormatterServices.GetUninitializedObject(type);
constructor.Invoke(self, new object[] { this, output, context, controller });
return self;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:AspViewEngine.cs
示例8: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext ctx, Controller c)
{
if (!controllersToSkip.IsMatch(GetControllerName(c)))
if (ctx.CurrentUser == null || !ctx.CurrentUser.Identity.IsAuthenticated)
return TryAutoLogin();
return true;
}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:8,代码来源:SecurityFilter.cs
示例9: Process
/// <summary>
/// Implementors should perform the action
/// on the exception. Note that the exception
/// is available in <see cref="IRailsEngineContext.LastException"/>
/// </summary>
/// <param name="context"></param>
public override void Process(IRailsEngineContext context)
{
ILoggerFactory factory = (ILoggerFactory) context.GetService(typeof (ILoggerFactory));
ILogger logger = factory.Create(context.CurrentController.GetType());
logger.Error(BuildStandardMessage(context));
InvokeNext(context);
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:14,代码来源:LoggingExceptionHandler.cs
示例10: BrailBase
/// <summary>
/// Initializes a new instance of the <see cref="BrailBase"/> class.
/// </summary>
/// <param name="viewEngine">The view engine.</param>
/// <param name="output">The output.</param>
/// <param name="context">The context.</param>
/// <param name="__controller">The controller.</param>
public BrailBase(BooViewEngine viewEngine, TextWriter output, IRailsEngineContext context, Controller __controller)
{
this.viewEngine = viewEngine;
this.outputStream = output;
this.context = context;
this.__controller = __controller;
InitProperties(context, __controller);
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:15,代码来源:BrailBase.cs
示例11: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
User user = (User)context.Session["logonUser"];
if (user == null)
{
return false;
}
return true;
}
开发者ID:biguoting,项目名称:MVCWebApplication,代码行数:9,代码来源:AuthenticationFilter.cs
示例12: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Params["printable"] != null)
{
controller.LayoutName = "printabletheme";
}
return true;
}
开发者ID:ralescano,项目名称:castle,代码行数:9,代码来源:PrintableFilter.cs
示例13: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Request.Headers["mybadheader"] != null)
{
context.Response.Write("Denied!");
return false;
}
return true;
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:9,代码来源:FilterBadHeader.cs
示例14: GetSteps
public WizardStepPage[] GetSteps(IRailsEngineContext context)
{
return new WizardStepPage[]
{
(WizardStepPage) kernel[typeof(Page1)],
(WizardStepPage) kernel[typeof(Page2)],
(WizardStepPage) kernel[typeof(Page3)],
(WizardStepPage) kernel[typeof(Page4)],
};
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:10,代码来源:TestWizardController.cs
示例15: Perform
public virtual bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!PerformAuthentication(context))
{
context.Response.Redirect("account", "authentication");
return false;
}
return true;
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:10,代码来源:AuthenticationCheckFilter.cs
示例16: Process
/// <summary>
/// Implementors should perform the action
/// on the exception. Note that the exception
/// is available in <see cref="IRailsEngineContext.LastException"/>
/// </summary>
/// <param name="context"></param>
public override void Process(IRailsEngineContext context)
{
Exception ex = context.LastException is TargetInvocationException
? context.LastException.InnerException
: context.LastException;
if (!excludedTypes.Contains(ex.GetType()))
{
InvokeNext(context);
}
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:16,代码来源:FilteredExceptionHandler.cs
示例17: Perform
/// <summary>
/// Implementors should perform they filter logic and
/// return <c>true</c> if the action should be processed.
/// </summary>
/// <param name="exec">When this filter is being invoked</param>
/// <param name="context">Current context</param>
/// <param name="controller">The controller instance</param>
/// <returns>
/// <c>true</c> if the action
/// should be invoked, otherwise <c>false</c>
/// </returns>
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Request.Headers["HTTP_X_MOZ"].Equals("prefetch"))
{
Trace.Write("prefetch detected: sending 403 Forbidden");
context.Response.StatusCode = 403;
return false;
}
return true;
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:22,代码来源:AntiGoogleWebAcceleratorFilter.cs
示例18: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.CurrentUser == null || !context.CurrentUser.Identity.IsAuthenticated)
{
context.Response.Redirect("admin", "login");
return false;
}
return true;
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:11,代码来源:AuthenticationFilter.cs
示例19: IsPreConditionSatisfied
protected override bool IsPreConditionSatisfied(IRailsEngineContext context)
{
bool isOk = Query["id"] == "1";
if (!isOk)
{
Redirect("TestWizardConditions", "Index");
}
return isOk;
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:11,代码来源:TestWizardConditionsController.cs
示例20: Perform
public override bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.CurrentUser.Identity.IsAuthenticated)
{
return true;
}
base.PerformAuthentication(context);
return true;
}
开发者ID:ralescano,项目名称:castle,代码行数:11,代码来源:AuthenticationAttemptFilter.cs
注:本文中的IRailsEngineContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论