我有一段代码需要一些严肃的文档,并想询问是否有类似于C#/ .NET的In-code XML-Documentation的功能可用于Embarcadero Delphi.我的目的是以在Delphi XE3的自动完成中突出显示的方式显示有关如何正确使用特定方法的某些信息.
像这样(C#):
/// <summary>
/// Some useful information helping other developers use this method correctly
/// </summary>
public static void ADocumentedMethod();
Run Code Online (Sandbox Code Playgroud)
Delphi XE3是否支持这样的东西?
谢谢你的阅读.
我的问题是关于Pure.Kromes对这篇文章的回答.我尝试使用他的方法实现我的页面的自定义错误消息,但有些问题我无法解释.
a)当我通过输入无效的URL(例如localhost:3001/NonexistantPage)引发404错误时,它默认为我的错误控制器的ServerError()Action,即使它应该转到NotFound().这是我的ErrorController:
public class ErrorController : Controller
{
public ActionResult NotFound()
{
Response.TrySkipIisCustomErrors = true;
Response.StatusCode = (int)HttpStatusCode.NotFound;
var viewModel = new ErrorViewModel()
{
ServerException = Server.GetLastError(),
HTTPStatusCode = Response.StatusCode
};
return View(viewModel);
}
public ActionResult ServerError()
{
Response.TrySkipIisCustomErrors = true;
Response.StatusCode = (int)HttpStatusCode.InternalServerError;
var viewModel = new ErrorViewModel()
{
ServerException = Server.GetLastError(),
HTTPStatusCode = Response.StatusCode
};
return View(viewModel);
}
}
我在Global.asax.cs中的错误路由:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.MapRoute(
name: "Error - 404",
url: "NotFound",
defaults: …Run Code Online (Sandbox Code Playgroud) delphi ×1