本文整理汇总了C#中Castle.MonoRail.Framework.Controller.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.GetType方法的具体用法?C# Controller.GetType怎么用?C# Controller.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Castle.MonoRail.Framework.Controller
的用法示例。
在下文中一共展示了Controller.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
String className = controller.GetType().FullName.Replace('.', '/');
if (className.StartsWith("SampleSite"))
{
className = className.Substring( "SampleSite/".Length );
}
controller.PropertyBag.Add("controllerfile", className + ".cs");
return true;
}
示例2: IncludeActions
public void IncludeActions(Controller controller)
{
Type controllerType = controller.GetType();
object[] atts = controllerType.GetCustomAttributes(typeof(CrudAttribute), false);
if (atts.Length == 0)
{
throw new Exception("CrudAttribute not used on " + controllerType.Name);
}
CrudAttribute crudAtt = (CrudAttribute) atts[0];
Type arType = crudAtt.ActiveRecordType;
String prefix = arType.Name.ToLower();
controller.DynamicActions["list"] = new ListAction(arType);
controller.DynamicActions["new"] = new NewAction();
controller.DynamicActions["create"] = new CreateAction(arType, prefix);
controller.DynamicActions["edit"] = new EditAction(arType, prefix);
controller.DynamicActions["update"] = new UpdateAction(arType, prefix);
controller.DynamicActions["confirmdelete"] = new ConfirmDeleteAction(arType, prefix);
controller.DynamicActions["delete"] = new DeleteAction(arType, prefix);
}