Ver Fonte

Infrastructure:

3.1.2020 v.1.0.1.0
New
 - Extents Infra class for diagnostics methods
 - Extents Infra class for layer management
 - Change structural container walking to obtain modules

Fix
 - fix Layer parent setting by default
Dalibor Votruba há 6 anos atrás
pai
commit
715ed9407f

+ 31 - 0
@Workbench/@Workbench.csproj

@@ -32,10 +32,28 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
+    <AssemblyOriginatorKeyFile>quadarax_strong_name_key.pfx</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>quadarax_strong_name_key.pfx</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
   <ItemGroup>
+    <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>..\Infrastructure\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
+    </Reference>
     <Reference Include="QDR.FND.Common, Version=1.0.0.7, Culture=neutral, PublicKeyToken=60b8fdcb29a015db, processorArchitecture=MSIL">
       <HintPath>..\Infrastructure\packages\Quadarax.Foundation.Common.1.0.0.7\lib\net472\QDR.FND.Common.dll</HintPath>
     </Reference>
+    <Reference Include="StructureMap, Version=4.7.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\Infrastructure\packages\StructureMap.4.7.1\lib\net45\StructureMap.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -46,12 +64,24 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Layers\DefaultBusinessLayer.cs" />
+    <Compile Include="Layers\DefaultDataLayer.cs" />
+    <Compile Include="Layers\DefaultGlobalLayer.cs" />
+    <Compile Include="Layers\Modules\IModBuss.cs" />
+    <Compile Include="Layers\Modules\IModData.cs" />
+    <Compile Include="Layers\Modules\IModGlobal.cs" />
+    <Compile Include="Layers\Modules\ModBusiness.cs" />
+    <Compile Include="Layers\Modules\ModData.cs" />
+    <Compile Include="Layers\Modules\ModGlobal.cs" />
+    <Compile Include="Layers\Modules\Module.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Layers\TestLayers.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
     <None Include="packages.config" />
+    <None Include="quadarax_strong_name_key.pfx" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Infrastructure\Infrastructure.csproj">
@@ -59,5 +89,6 @@
       <Name>Infrastructure</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 19 - 1
@Workbench/App.config

@@ -1,6 +1,24 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
-    <startup> 
+  <configSections>
+    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+  </configSections>
+  <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
     </startup>
+
+
+  <log4net>
+    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+      <layout type="log4net.Layout.PatternLayout">
+        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
+      </layout>
+    </appender>
+
+
+    <root>
+      <level value="ALL" />
+      <appender-ref ref="ConsoleAppender" />
+    </root>
+  </log4net>
 </configuration>

+ 27 - 0
@Workbench/Layers/DefaultBusinessLayer.cs

@@ -0,0 +1,27 @@
+using System;
+using _Workbench.Layers.Modules;
+using Quadarax.Foundation.Infrastructure.Layers;
+using StructureMap;
+
+
+namespace _Workbench.Layers
+{
+    public class DefaultBusinessLayer : BusinessLayer
+    {
+        public DefaultBusinessLayer(string name, Layer parentLayer) : base(name, parentLayer)
+        {
+        }
+
+        protected override void OnLayerRegistry()
+        {
+            AddChildLayer(new DefaultDataLayer("DatLayer", this));
+        }
+
+        protected override void OnModuleRegistry(IContainer container)
+        {
+            container.Configure(x => 
+                x.For<IModBuss>().Use<ModBusiness>()
+            );
+        }
+    }
+}

+ 23 - 0
@Workbench/Layers/DefaultDataLayer.cs

@@ -0,0 +1,23 @@
+using _Workbench.Layers.Modules;
+using Quadarax.Foundation.Infrastructure.Layers;
+using StructureMap;
+
+namespace _Workbench.Layers
+{
+    public class DefaultDataLayer : DataLayer
+    {
+        public DefaultDataLayer(string name, Layer parentLayer) : base(name, parentLayer)
+        {
+        }
+
+        protected override void OnLayerRegistry()
+        {
+        }
+
+        protected override void OnModuleRegistry(IContainer container)
+        {
+            container.Configure(x=>
+                x.For<IModData>().Use<ModData>());
+        }
+    }
+}

+ 25 - 0
@Workbench/Layers/DefaultGlobalLayer.cs

@@ -0,0 +1,25 @@
+using _Workbench.Layers.Modules;
+using Quadarax.Foundation.Infrastructure.Layers;
+using StructureMap;
+
+namespace _Workbench.Layers
+{
+    public class DefaultGlobalLayer : GlobalLayer
+    {
+        public DefaultGlobalLayer(string name) : base(name)
+        {
+
+        }
+
+        protected override void OnLayerRegistry()
+        {
+            AddChildLayer(new DefaultBusinessLayer("BusLayer", this));
+        }
+
+        protected override void OnModuleRegistry(IContainer container)
+        {
+            container.Configure(x=>
+                x.For<IModGlobal>().Use<ModGlobal>().Ctor<string>().Is("initialized"));
+        }
+    }
+}

+ 8 - 0
@Workbench/Layers/Modules/IModBuss.cs

@@ -0,0 +1,8 @@
+using Quadarax.Foundation.Infrastructure;
+
+namespace _Workbench.Layers.Modules
+{
+    public interface IModBuss : IModule
+    {
+    }
+}

+ 8 - 0
@Workbench/Layers/Modules/IModData.cs

@@ -0,0 +1,8 @@
+using Quadarax.Foundation.Infrastructure;
+
+namespace _Workbench.Layers.Modules
+{
+    public interface IModData : IModule
+    {
+    }
+}

+ 8 - 0
@Workbench/Layers/Modules/IModGlobal.cs

@@ -0,0 +1,8 @@
+using Quadarax.Foundation.Infrastructure;
+
+namespace _Workbench.Layers.Modules
+{
+    public interface IModGlobal : IModule
+    {
+    }
+}

+ 18 - 0
@Workbench/Layers/Modules/ModBusiness.cs

@@ -0,0 +1,18 @@
+using System;
+using Quadarax.Foundation.Infrastructure.Layers;
+
+namespace _Workbench.Layers.Modules
+{
+    public class ModBusiness : Module, IModBuss
+    {
+        private IModData _data;
+        private IModGlobal _global;
+        public ModBusiness(IModGlobal context, IModData data) : base(typeof(ModBusiness).Name)
+        {
+            _global = context ?? throw new ArgumentNullException(nameof(context));
+            _data = data ?? throw new ArgumentNullException(nameof(data));
+        }
+
+        public override LayerClassificationEnum Layer => LayerClassificationEnum.Business;
+    }
+}

+ 17 - 0
@Workbench/Layers/Modules/ModData.cs

@@ -0,0 +1,17 @@
+using System;
+using Quadarax.Foundation.Infrastructure.Layers;
+
+namespace _Workbench.Layers.Modules
+{
+    public class ModData : Module, IModData
+    {
+        private IModGlobal _global;
+
+        public ModData(IModGlobal context) : base(typeof(ModData).Name)
+        {
+            _global = context ?? throw new ArgumentNullException(nameof(context));
+        }
+
+        public override LayerClassificationEnum Layer => LayerClassificationEnum.Data;
+    }
+}

+ 13 - 0
@Workbench/Layers/Modules/ModGlobal.cs

@@ -0,0 +1,13 @@
+using Quadarax.Foundation.Infrastructure.Layers;
+
+namespace _Workbench.Layers.Modules
+{
+    public class ModGlobal : Module, IModGlobal
+    {
+        public ModGlobal(string name) : base(name)
+        {
+        }
+
+        public override LayerClassificationEnum Layer => LayerClassificationEnum.Global;
+    }
+}

+ 23 - 0
@Workbench/Layers/Modules/Module.cs

@@ -0,0 +1,23 @@
+using System;
+using Quadarax.Foundation.Infrastructure;
+using Quadarax.Foundation.Infrastructure.Layers;
+
+namespace _Workbench.Layers.Modules
+{
+    public abstract class Module : IModule
+    {
+        private string _name;
+
+        public Module(string name)
+        {
+            _name = name;
+        }
+
+        public string GetModuleName()
+        {
+            return _name;
+        }
+
+        public abstract LayerClassificationEnum Layer { get; }
+    }
+}

+ 24 - 0
@Workbench/Layers/TestLayers.cs

@@ -0,0 +1,24 @@
+using System;
+using _Workbench.Layers.Modules;
+using Quadarax.Foundation.Infrastructure;
+
+namespace _Workbench.Layers
+{
+    public static class TestLayers
+    {
+        public static void Test()
+        {
+            Infra.Initialize<DefaultGlobalLayer>("TestApp");
+
+            Console.WriteLine("Layer names:");
+            Console.WriteLine(string.Join(",", Infra.GetLayerNames()));
+            Console.WriteLine("Dump:");
+            Console.WriteLine(Infra.Dump());
+            Console.WriteLine("Container dump:");
+            Console.WriteLine(Infra.DumpContainers());         
+            var x = Infra.Get<IModGlobal>();
+            var y = Infra.Get<IModData>();
+            Console.WriteLine($"Context: {x.GetModuleName()}");
+        }
+    }
+}

+ 8 - 1
@Workbench/Program.cs

@@ -1,4 +1,6 @@
 using System;
+using _Workbench.Layers;
+using log4net.Config;
 
 namespace _Workbench
 {
@@ -6,7 +8,12 @@ namespace _Workbench
     {
         static void Main(string[] args)
         {
-         
+
+            XmlConfigurator.Configure();
+
+            TestLayers.Test();
+            Console.WriteLine("Press any key to close.");
+            Console.ReadKey();
         }
     }
 }

+ 3 - 0
@Workbench/packages.config

@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="log4net" version="2.0.8" targetFramework="net472" />
   <package id="Quadarax.Foundation.Common" version="1.0.0.7" targetFramework="net472" />
+  <package id="StructureMap" version="4.7.1" targetFramework="net472" />
+  <package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net472" />
 </packages>

BIN
@Workbench/quadarax_strong_name_key.pfx


+ 1 - 0
Assets/Certificates/install_pfx.cmd

@@ -1,4 +1,5 @@
 rem *** Should by run in Visual Studio Developer Console ***
 rem *** key password is required ***
 sn -p quadarax_strong_name_key.pfx quadarax_strong_name_key.pub
+sn -d quadarax_strong_name_key
 sn -i quadarax_strong_name_key.pfx quadarax_strong_name_key 

+ 37 - 2
Infrastructure/GlobalContainer.cs

@@ -1,4 +1,6 @@
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using log4net;
 using Quadarax.Foundation.Common.Object.Bee.Core.Pattern;
 using Quadarax.Foundation.Infrastructure.Layers;
@@ -18,14 +20,47 @@ namespace Quadarax.Foundation.Infrastructure
             _logger = LogManager.GetLogger(GetType());
         }
 
-        public void CreateGlobal<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer
+        public void CreateGlobal<TGlobalLayer>(string globalLayerName,params object[] initialArgs) where TGlobalLayer : GlobalLayer
         {
-            _global = (GlobalLayer) Activator.CreateInstance(typeof(TGlobalLayer), globalLayerName);
+            var ctorArgs = new List<object>();
+            ctorArgs.Add(globalLayerName);
+            ctorArgs.AddRange(initialArgs);
+
+            _global = (GlobalLayer) Activator.CreateInstance(typeof(TGlobalLayer), ctorArgs.ToArray());
+        }
+
+        public string[] GetLayerNames()
+        {
+            var names = new List<string>(_global.GetChildLayerNames());
+            names.Insert(0,_global.Name);
+            return names.ToArray();
+        }
+
+        public Layer GetLayerByName(string layerName)
+        {
+            return _global.Name == layerName ? 
+                _global :
+                _global.FindChildLayer(layerName).FirstOrDefault();
         }
 
+
+        public IEnumerable<TLayer> GetLayer<TLayer>() where TLayer : Layer
+        {
+            var layers = new List<TLayer>();
+            if (_global.GetType() == typeof(TLayer))
+                layers.Add(_global as TLayer);
+            layers.AddRange(_global.FindChildLayer<TLayer>());
+            return layers.ToArray();
+        }  
+
         public string Dump()
         {
             return _global.Dump();
         }
+
+        public string DumpContainer()
+        {
+            return _global.DumpContainer(true);
+        }
     }
 }

+ 15 - 1
Infrastructure/Infra.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using log4net;
 using Quadarax.Foundation.Infrastructure.Layers;
 
@@ -11,7 +12,7 @@ namespace Quadarax.Foundation.Infrastructure
 
         public static bool IsInitialized { get; private set; }
 
-        public static void Initialize<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer
+        public static void Initialize<TGlobalLayer>(string globalLayerName,params object[] initialArgs) where TGlobalLayer : GlobalLayer
         {
             if (IsInitialized)
                 throw new InvalidOperationException("Infrastructure is already initialized!");
@@ -27,11 +28,24 @@ namespace Quadarax.Foundation.Infrastructure
             return GlobalContainer.Instance.RootLayer.Get<TModule>();
         }
 
+        public static IEnumerable<string> GetLayerNames()
+        {
+            return GlobalContainer.Instance.GetLayerNames();
+        }
+
         public static string Dump()
         {
             if (!IsInitialized)
                 return "Not initialized!";
             return GlobalContainer.Instance.Dump();
         }
+
+        public static string DumpContainers()
+        {
+            if (!IsInitialized)
+                return "Not initialized!";
+            return GlobalContainer.Instance.DumpContainer();
+        }
+
     }
 }

+ 4 - 4
Infrastructure/Infrastructure.csproj

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\..\Application\qdr.app.messagepanel\packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('..\..\Application\qdr.app.messagepanel\packages\ILMerge.3.0.29\build\ILMerge.props')" />
+  <Import Project="packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('packages\ILMerge.3.0.29\build\ILMerge.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -41,10 +41,10 @@
   <PropertyGroup>
     <StartupObject />
   </PropertyGroup>
-  <PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
     <SignAssembly>true</SignAssembly>
   </PropertyGroup>
-  <PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
     <AssemblyOriginatorKeyFile>quadarax_strong_name_key.pfx</AssemblyOriginatorKeyFile>
   </PropertyGroup>
   <ItemGroup>
@@ -98,7 +98,7 @@
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('.\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '.\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
+    <Error Condition="!Exists('packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILMerge.3.0.29\build\ILMerge.props'))" />
   </Target>
   <Target Name="MergeAssembly" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
     <Message Text="*** Merging assemblies into $(TargetDir)merged\$(TargetName).dll ***" />

+ 1 - 1
Infrastructure/Layers/BusinessLayer.cs

@@ -2,7 +2,7 @@
 {
     public abstract class BusinessLayer : Layer
     {
-        protected BusinessLayer(string name) : base(name)
+        protected BusinessLayer(string name, Layer parentLayer) : base(name, parentLayer)
         {
             LayerType = LayerClassificationEnum.Business;
         }

+ 1 - 1
Infrastructure/Layers/DataLayer.cs

@@ -2,7 +2,7 @@
 {
     public abstract class DataLayer : Layer
     {
-        protected DataLayer(string name) : base(name)
+        protected DataLayer(string name,Layer parentLayer) : base(name, parentLayer)
         {
             LayerType = LayerClassificationEnum.Data;
         }

+ 2 - 9
Infrastructure/Layers/GlobalLayer.cs

@@ -2,19 +2,12 @@
 
 namespace Quadarax.Foundation.Infrastructure.Layers
 {
-    public class GlobalLayer : Layer
+    public abstract class GlobalLayer : Layer
     {
-        protected GlobalLayer(string name) : base(name)
+        protected GlobalLayer(string name) : base(name, null)
         {
             LayerType = LayerClassificationEnum.Global;
         }
 
-        protected override void OnLayerRegistry()
-        {
-        }
-
-        protected override void OnModuleRegistry(IContainer container)
-        {
-        }
     }
 }

+ 98 - 11
Infrastructure/Layers/Layer.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
 using log4net;
 using Quadarax.Foundation.Common.Object;
@@ -21,7 +22,7 @@ namespace Quadarax.Foundation.Infrastructure.Layers
 
         public LayerClassificationEnum LayerType { get; protected set; }
 
-        protected Layer(string name, Layer parentLayer = null)
+        protected Layer(string name, Layer parentLayer)
         {
             if (string.IsNullOrEmpty(name))
                 throw new ArgumentNullException(nameof(name), "Infrastucture layer must have a name.");
@@ -38,7 +39,8 @@ namespace Quadarax.Foundation.Infrastructure.Layers
 
         private void InitializeInternal()
         {
-            _container = _parentLayer == null ? new Container() : _parentLayer._container.CreateChildContainer();
+            // _container = _parentLayer == null ? new Container() : _parentLayer._container.CreateChildContainer();
+            _container = _parentLayer == null ? new Container() : _parentLayer._container;
             OnModuleRegistry(_container);
             OnLayerRegistry();
             Log.Info($"Layer '{Name}' initialization done");
@@ -48,7 +50,6 @@ namespace Quadarax.Foundation.Infrastructure.Layers
         {
             if (layer==null)
                 throw new ArgumentNullException(nameof(layer));
-
             _childLayers.Add(layer);
             Log.Info($"Layer 'Name' append child layer '{layer.Name}'. Current child count on layer '{Name}' is {ChildLayersCount} childs.");
         }
@@ -59,7 +60,6 @@ namespace Quadarax.Foundation.Infrastructure.Layers
 
         protected override void OnDisposing()
         {
-            _parentLayer?.Dispose();
             _parentLayer = null;
 
             if (_childLayers != null)
@@ -75,21 +75,108 @@ namespace Quadarax.Foundation.Infrastructure.Layers
 
         public TModule Get<TModule>() where TModule : IModule
         {
-            return _container.GetInstance<TModule>();
+            Log.Debug($"Try to find module '{typeof(TModule)}' in layer '{Name}'...");
+            var result = _container.TryGetInstance<TModule>();
+            if (result != null)
+                return result;
+
+            Log.Debug($"Cannot find module '{typeof(TModule)}' in layer '{Name}'. Trying to find in child layers.");
+
+            foreach (var child in _childLayers)
+            {
+                result = child.Get<TModule>();
+                if (result != null)
+                    return result;
+            }
+
+            return default(TModule);
+        }
+
+        public IEnumerable<TLayer> FindChildLayer<TLayer>(bool recursive = true) where TLayer : Layer
+        {
+            var result = new List<TLayer>();
+            if (recursive)
+            {
+                foreach (var child in _childLayers)
+                {
+                    result.AddRange(child.FindChildLayer<TLayer>(recursive));
+                }
+            }
+            result.AddRange(_childLayers.Where(x => x.GetType() == typeof(TLayer)).Select(x=> (TLayer)x));
+            return result.ToArray();
+        }
+
+        public IEnumerable<Layer> FindChildLayer(string layerName, bool recursive = true)
+        {
+            var result = new List<Layer>();
+            if (recursive)
+            {
+                foreach (var child in _childLayers)
+                {
+                    result.AddRange(child.FindChildLayer(layerName, recursive));
+                }
+            }
+
+            result.AddRange(_childLayers.Where(x => x.Name == layerName));
+            return result.ToArray();
+        }
+
+        public IEnumerable<string> GetChildLayerNames(bool recursive = true)
+        {
+            var result = new List<string>();
+            if (recursive)
+            {
+                foreach (var child in _childLayers)
+                {
+                    result.AddRange(child.GetChildLayerNames(recursive));
+                }
+            }
+            result.AddRange(_childLayers.Select(x => x.Name));
+            return result.ToArray();
         }
 
         public string Dump()
+        {
+            return DumpInternal(0);
+        }
+
+        private string DumpInternal(int level)
         {
             var sb = new StringBuilder();
-            sb.Append("*** Layer: ").Append(Name).Append(" [").Append(LayerType).Append("] * BEGIN ***").AppendLine();
-            sb.Append("Parent:").AppendLine();
+            sb.Append(new string(' ', level * 3)).Append("*** Layer [").Append(level).Append("]: ").Append(Name).Append(" [").Append(LayerType).Append("] * BEGIN ***").AppendLine();
+            sb.Append(new string(' ', level * 3)).Append("Parent:").AppendLine();
             sb.Append(_parentLayer == null ? "none" : _parentLayer.Name);
             sb.AppendLine();
-            sb.Append("Childs:").AppendLine();
-            foreach (var child in _childLayers)
-                sb.Append(child.Dump()).AppendLine();
-            sb.Append("*** Layer: ").Append(Name).Append(" [").Append(LayerType).Append("] * END ***").AppendLine();
+            sb.Append(new string(' ', level * 3)).Append("Childs:").AppendLine();
+            if (_childLayers.Count > 0)
+                foreach (var child in _childLayers)
+                    sb.Append(child.DumpInternal(level + 1)).AppendLine();
+            else
+                sb.Append(new string(' ', level * 3)).Append("no childs").AppendLine();
+
+            sb.Append(new string(' ', level * 3)).Append("*** Layer [").Append(level).Append("]: ").Append(LayerType).Append("] * END ***").AppendLine();
             return sb.ToString();
         }
+
+        public string DumpContainer(bool recursive = false)
+        {
+            var sb = new StringBuilder();
+            sb.Append("LAYER: ").Append(Name).AppendLine();
+            sb.AppendLine(_container.WhatDoIHave());
+            if (recursive)
+            {
+                sb.Append("LAYER: ").Append(Name).Append(" childs").AppendLine();
+                foreach (var layer in _childLayers)
+                {
+                    sb.AppendLine(layer.DumpContainer(recursive));
+                }
+            }
+            return sb.ToString();
+        }
+
+        public override string ToString()
+        {
+            return $"Layer={Name};Type={LayerType};ChildCount={ChildLayersCount}";
+        }
     }
 }

+ 1 - 1
Infrastructure/Layers/PresentationLayer.cs

@@ -3,7 +3,7 @@
     public abstract class PresentationLayer : Layer
     {
 
-        protected PresentationLayer(string name) : base(name)
+        protected PresentationLayer(string name, Layer parentLayer) : base(name, parentLayer)
         {
             LayerType = LayerClassificationEnum.Presentation;
         }

+ 1 - 1
Infrastructure/Layers/ServiceLayer.cs

@@ -2,7 +2,7 @@
 {
     public abstract class ServiceLayer : Layer
     {
-        protected ServiceLayer(string name) : base(name)
+        protected ServiceLayer(string name, Layer parentLayer) : base(name, parentLayer)
         {
             LayerType = LayerClassificationEnum.Service;
         }

+ 2 - 2
Infrastructure/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.0.1.0")]
+[assembly: AssemblyFileVersion("1.0.1.0")]

+ 8 - 3
Infrastructure/QDR.FND.Infrastructure.nuspec

@@ -2,7 +2,7 @@
 <package>
   <metadata>
     <id>Quadarax.Foundation.Infrastructure</id>
-    <version>1.0.0.0</version>
+    <version>1.0.1.0</version>
     <title>Quadarax.Foundation.Infrastructure</title>
     <authors>Dalibor Votruba, Quadarax</authors>
     <owners>Dalibor Votruba</owners>
@@ -11,9 +11,14 @@
     <requireLicenseAcceptance>false</requireLicenseAcceptance>
     <description>Implementations of simple infrastructure patterns (Component model). Contains StructureMap implementation.</description>
     <releaseNotes>
-      28.12.2019 v.1.0.0.0
+      3.1.2020 v.1.0.1.0
       New
-      - Initial version
+      - Extents Infra class for diagnostics methods
+      - Extents Infra class for layer management
+      - Change structural container walking to obtain modules
+
+      Fix
+      - fix Layer parent setting by default
     </releaseNotes>
     <copyright>Copyright (c) 2020 Quadarax</copyright>
     <tags>quadarax, foundation, infrastructure, component model, qdr, fnd, library</tags>

+ 9 - 0
Infrastructure/ReleaseNote.txt

@@ -1,3 +1,12 @@
+3.1.2020 v.1.0.1.0
+New
+ - Extents Infra class for diagnostics methods
+ - Extents Infra class for layer management
+ - Change structural container walking to obtain modules
+
+Fix
+ - fix Layer parent setting by default
+
 28.12.2019 v.1.0.0.0
 New
  - Initial version