|
3 | 3 | | Client Ignia, LLC |
4 | 4 | | Project Sample OnTopic Site |
5 | 5 | \=============================================================================================================================*/ |
| 6 | +using System.IO; |
6 | 7 | using Microsoft.AspNetCore.Builder; |
7 | 8 | using Microsoft.AspNetCore.Hosting; |
8 | 9 | using Microsoft.AspNetCore.Http; |
9 | 10 | using Microsoft.AspNetCore.Mvc.Controllers; |
| 11 | +using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation; |
10 | 12 | using Microsoft.AspNetCore.Mvc.ViewComponents; |
11 | 13 | using Microsoft.Extensions.Configuration; |
12 | 14 | using Microsoft.Extensions.DependencyInjection; |
| 15 | +using Microsoft.Extensions.FileProviders; |
13 | 16 | using Microsoft.Extensions.Hosting; |
14 | 17 | using OnTopic.AspNetCore.Mvc; |
15 | 18 | using OnTopic.Editor.AspNetCore; |
@@ -74,14 +77,21 @@ public void ConfigureServices(IServiceCollection services) { |
74 | 77 | /*------------------------------------------------------------------------------------------------------------------------ |
75 | 78 | | Configure: MVC |
76 | 79 | \-----------------------------------------------------------------------------------------------------------------------*/ |
77 | | - services.AddControllersWithViews() |
| 80 | + var mvcBuilder = services.AddControllersWithViews() |
78 | 81 |
|
79 | 82 | //Add OnTopic support |
80 | 83 | .AddTopicSupport() |
81 | 84 |
|
82 | 85 | //Add OnTopic editor support |
83 | 86 | .AddTopicEditor(); |
84 | 87 |
|
| 88 | + /*------------------------------------------------------------------------------------------------------------------------ |
| 89 | + | Configure: Runtime View Compilation |
| 90 | + \-----------------------------------------------------------------------------------------------------------------------*/ |
| 91 | + if (HostingEnvironment.IsDevelopment()) { |
| 92 | + mvcBuilder.AddRazorRuntimeCompilation(); |
| 93 | + } |
| 94 | + |
85 | 95 | /*------------------------------------------------------------------------------------------------------------------------ |
86 | 96 | | Configure: Watch Razor Class Library (RCLs) views |
87 | 97 | >------------------------------------------------------------------------------------------------------------------------- |
|
0 commit comments