|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.Linq; |
4 | 3 | using System.Reflection; |
5 | | -using System.Web.Mvc; |
6 | 4 | using DeveloperTools.Models; |
7 | 5 | using EPiServer.Framework.Initialization; |
8 | | -using EPiServer.ServiceLocation.Internal; |
| 6 | +using EPiServer.Web; |
| 7 | +using Microsoft.AspNetCore.Mvc; |
9 | 8 |
|
10 | 9 | namespace DeveloperTools.Controllers |
11 | 10 | { |
12 | 11 | public class IOCController : DeveloperToolsController |
13 | 12 | { |
14 | 13 | public ActionResult Index() |
15 | 14 | { |
16 | | - var ie = (InitializationEngine) typeof(InitializationModule).GetField("_engine", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); |
| 15 | + //var ie = (InitializationEngine) typeof(InitializationModule).GetField("_engine", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); |
17 | 16 |
|
18 | | - var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null) as StructureMapConfiguration; |
| 17 | + //var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null) as StructureMapConfiguration; |
19 | 18 |
|
20 | | - var iocEntries = new List<IOCEntry>(); |
21 | | - var typeErrors = new List<string>(); |
| 19 | + //var iocEntries = new List<IOCEntry>(); |
| 20 | + //var typeErrors = new List<string>(); |
22 | 21 |
|
23 | | - if (services != null) |
24 | | - { |
25 | | - var container = services.Container; |
| 22 | + //if (services != null) |
| 23 | + //{ |
| 24 | + // var container = services.Container; |
26 | 25 |
|
27 | | - foreach (var plugin in container.Model.PluginTypes) |
28 | | - { |
29 | | - try |
30 | | - { |
31 | | - var defaultType = plugin.Default?.ReturnedType; |
32 | | - if (plugin.Default != null && defaultType == null) |
33 | | - { |
34 | | - defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType(); |
35 | | - } |
| 26 | + // foreach (var plugin in container.Model.PluginTypes) |
| 27 | + // { |
| 28 | + // try |
| 29 | + // { |
| 30 | + // var defaultType = plugin.Default?.ReturnedType; |
| 31 | + // if (plugin.Default != null && defaultType == null) |
| 32 | + // { |
| 33 | + // defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType(); |
| 34 | + // } |
36 | 35 |
|
37 | | - foreach (var entry in plugin.Instances.Where(i => i != null)) |
38 | | - { |
39 | | - var concreteType = entry.ReturnedType; |
40 | | - if (concreteType == null && entry.PluginType.ContainsGenericParameters == false) |
41 | | - { |
42 | | - concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType(); |
43 | | - } |
| 36 | + // foreach (var entry in plugin.Instances.Where(i => i != null)) |
| 37 | + // { |
| 38 | + // var concreteType = entry.ReturnedType; |
| 39 | + // if (concreteType == null && entry.PluginType.ContainsGenericParameters == false) |
| 40 | + // { |
| 41 | + // concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType(); |
| 42 | + // } |
44 | 43 |
|
45 | | - iocEntries.Add(new IOCEntry |
46 | | - { |
47 | | - PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}", |
48 | | - ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}", |
| 44 | + // iocEntries.Add(new IOCEntry |
| 45 | + // { |
| 46 | + // PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}", |
| 47 | + // ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}", |
49 | 48 |
|
50 | | - Scope = plugin.Lifecycle.ToString(), |
51 | | - IsDefault = defaultType == concreteType |
52 | | - }); |
53 | | - } |
54 | | - } |
55 | | - catch (Exception ex) |
56 | | - { |
57 | | - typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message); |
58 | | - } |
59 | | - } |
60 | | - } |
| 49 | + // Scope = plugin.Lifecycle.ToString(), |
| 50 | + // IsDefault = defaultType == concreteType |
| 51 | + // }); |
| 52 | + // } |
| 53 | + // } |
| 54 | + // catch (Exception ex) |
| 55 | + // { |
| 56 | + // typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message); |
| 57 | + // } |
| 58 | + // } |
| 59 | + //} |
61 | 60 |
|
62 | | - var model = new IOCModel { IOCEntries = iocEntries, LoadingErrors = typeErrors }; |
| 61 | + var model = new IOCModel |
| 62 | + { |
| 63 | + //IOCEntries = iocEntries, |
| 64 | + //LoadingErrors = typeErrors |
| 65 | + }; |
63 | 66 |
|
64 | 67 | return View(model); |
65 | 68 | } |
|
0 commit comments