-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModularViewLocator.cs
58 lines (51 loc) · 1.31 KB
/
ModularViewLocator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.Collections.Generic;
using Microsoft.AspNet.Mvc.Razor;
using Microsoft.Extensions.Logging;
namespace DasJott
{
public class ModularViewLocator : IViewLocationExpander
{
public ILogger Logger { get; set; }
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
if (Logger != null) { Logger.LogVerbose("ExpandViewLocations called"); }
// default:
// "/Views/{1}/{0}.cshtml"
// also:
// 0 = action
// 1 = controller
var routes = new string[] {
"/Sections/{1}/Views/{0}.cshtml",
"/Sections/Common/Views/{0}.cshtml"
};
return routes;
}
public void PopulateValues(ViewLocationExpanderContext context)
{
}
}
// public class ModuleView : IDisposable
// {
// protected HtmlHelper Helper;
//
// public ModuleView(HtmlHelper helper, string title)
// {
// Helper = helper;
//
//
// var html = new StringBuilder();
// html.AppendFormat("<div id='{0}'>", title);
//
// Helper.ViewContext.Writer.Write(html.ToString());
// }
//
// public void Dispose()
// {
// var html = new StringBuilder();
// html.Append("</div>");
//
// Helper.ViewContext.Writer.Write(html.ToString());
// }
//
// }
}