Skip to content

Commit 78d1485

Browse files
committed
Introduced run-time compilation of local views
1 parent 13e6452 commit 78d1485

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

OnTopic.Editor.AspNetCore.Host/Startup.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
| Client Ignia, LLC
44
| Project Sample OnTopic Site
55
\=============================================================================================================================*/
6+
using System.IO;
67
using Microsoft.AspNetCore.Builder;
78
using Microsoft.AspNetCore.Hosting;
89
using Microsoft.AspNetCore.Http;
910
using Microsoft.AspNetCore.Mvc.Controllers;
11+
using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
1012
using Microsoft.AspNetCore.Mvc.ViewComponents;
1113
using Microsoft.Extensions.Configuration;
1214
using Microsoft.Extensions.DependencyInjection;
15+
using Microsoft.Extensions.FileProviders;
1316
using Microsoft.Extensions.Hosting;
1417
using OnTopic.AspNetCore.Mvc;
1518
using OnTopic.Editor.AspNetCore;
@@ -74,14 +77,21 @@ public void ConfigureServices(IServiceCollection services) {
7477
/*------------------------------------------------------------------------------------------------------------------------
7578
| Configure: MVC
7679
\-----------------------------------------------------------------------------------------------------------------------*/
77-
services.AddControllersWithViews()
80+
var mvcBuilder = services.AddControllersWithViews()
7881

7982
//Add OnTopic support
8083
.AddTopicSupport()
8184

8285
//Add OnTopic editor support
8386
.AddTopicEditor();
8487

88+
/*------------------------------------------------------------------------------------------------------------------------
89+
| Configure: Runtime View Compilation
90+
\-----------------------------------------------------------------------------------------------------------------------*/
91+
if (HostingEnvironment.IsDevelopment()) {
92+
mvcBuilder.AddRazorRuntimeCompilation();
93+
}
94+
8595
/*------------------------------------------------------------------------------------------------------------------------
8696
| Configure: Watch Razor Class Library (RCLs) views
8797
>-------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)