aspnetcore/src/Microsoft.AspNet.Diagnostic.../Views/DatabaseErrorPage.cshtml

96 lines
2.9 KiB
Plaintext

@using System
@using System.Linq
@using JetBrains.Annotations;
@using Microsoft.AspNet.Diagnostics.Entity
@using Microsoft.AspNet.Diagnostics.Entity.Utilities;
@using Microsoft.AspNet.Diagnostics.Entity.Views
@{
Response.StatusCode = 500;
// TODO: Response.ReasonPhrase = "Internal Server Error";
Response.ContentType = "text/html";
Response.ContentLength = null; // Clear any prior Content-Length
}
@functions
{
private DatabaseErrorPageModel _model;
public virtual DatabaseErrorPageModel Model
{
get { return _model; }
[param: NotNull]
set
{
Check.NotNull(value, "value");
_model = value;
}
}
}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Internal Server Error</title>
<style>
<%$ include: ErrorPage.css %>
@string.Empty
</style>
</head>
<body>
<h1>@Strings.DatabaseErrorPage_Title</h1>
@if (Model.Options.ShowExceptionDetails)
{
<p>
@for (Exception ex = Model.Exception; ex != null; ex = ex.InnerException)
{
<span>@ex.GetType().Name: @ex.Message</span>
<br />
}
</p>
<hr />
}
@if (!Model.DatabaseExists && !Model.PendingMigrations.Any())
{
<h2>@Strings.FormatDatabaseErrorPage_NoDbOrMigrationsTitle(Model.ContextType.Name)</h2>
<p>@Strings.DatabaseErrorPage_NoDbOrMigrationsInfo</p>
<code> @Strings.DatabaseErrorPage_AddMigrationCommand </code>
<br />
<code> @Strings.DatabaseErrorPage_ApplyMigrationsCommand </code>
<hr />
}
else if (Model.PendingMigrations.Any())
{
<div>
<h2>@Strings.FormatDatabaseErrorPage_PendingMigrationsTitle(Model.ContextType.Name)</h2>
<p>@Strings.FormatDatabaseErrorPage_PendingMigrationsInfo(Model.ContextType.Name)</p>
@if (Model.Options.ListMigrations)
{
<ul>
@foreach (var migration in Model.PendingMigrations)
{
<li>@migration</li>
}
</ul>
}
<p>@Strings.DatabaseErrorPage_HowToApplyFromCmd</p>
<code>@Strings.DatabaseErrorPage_ApplyMigrationsCommand</code>
<hr />
</div>
}
else if (Model.PendingModelChanges)
{
<div>
<h2>@Strings.FormatDatabaseErrorPage_PendingChangesTitle(Model.ContextType.Name)</h2>
<p>@Strings.DatabaseErrorPage_PendingChangesInfo</p>
<code>@Strings.DatabaseErrorPage_AddMigrationCommand</code>
<br />
<code>@Strings.DatabaseErrorPage_ApplyMigrationsCommand</code>
<hr />
</div>
}
</body>
</html>