In regards to ASP.NET MVC Core app. I’ve noticed that current .NET tutorials indicate using tag helpers for environment dev/prod sections and etc. What is the Service Stack recommended way? SS uses inline @if (DebugMode)
.
Is Service Stack separating from ASP.NET in that way? Also ASP.NET uses IHostingEnvironment env
and ServiceStack seems to use AppSettings.Get(nameof(HostConfig.DebugMode), false)
. When is it appropriate to use what?
ASP.NET MVC Core:
<environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
Service Stack Razor (.NET Core):
@if (DebugMode) {
<script>@Html.IncludeFile("js/hot-fileloader.js")</script>
}