Przeglądaj źródła

Infrastructure:

Initial version
Dalibor Votruba 6 lat temu
rodzic
commit
36476da6b2

+ 4 - 0
Assets/Certificates/install_pfx.cmd

@@ -0,0 +1,4 @@
+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 -i quadarax_strong_name_key.pfx quadarax_strong_name_key 

BIN
Assets/Certificates/quadarax_strong_name_key.pub


+ 1 - 1
Infrastructure/GlobalContainer.cs

@@ -18,7 +18,7 @@ namespace Quadarax.Foundation.Infrastructure
             _logger = LogManager.GetLogger(GetType());
         }
 
-        public void CreateGlobal<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer, new()
+        public void CreateGlobal<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer
         {
             _global = (GlobalLayer) Activator.CreateInstance(typeof(TGlobalLayer), globalLayerName);
         }

+ 1 - 1
Infrastructure/Infra.cs

@@ -11,7 +11,7 @@ namespace Quadarax.Foundation.Infrastructure
 
         public static bool IsInitialized { get; private set; }
 
-        public static void Initialize<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer, new()
+        public static void Initialize<TGlobalLayer>(string globalLayerName) where TGlobalLayer : GlobalLayer
         {
             if (IsInitialized)
                 throw new InvalidOperationException("Infrastructure is already initialized!");

+ 31 - 2
Infrastructure/Infrastructure.csproj

@@ -1,5 +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="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,6 +13,8 @@
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -51,7 +54,7 @@
     <Reference Include="QDR.FND.Common, Version=1.0.0.7, Culture=neutral, PublicKeyToken=60b8fdcb29a015db, processorArchitecture=MSIL">
       <HintPath>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">
+    <Reference Include="StructureMap">
       <HintPath>packages\StructureMap.4.7.1\lib\net45\StructureMap.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -80,7 +83,9 @@
     <None Include="App.config" />
     <None Include="create_package.ps1" />
     <None Include="packages.config" />
-    <None Include="QDR.FND.Infrastructure.nuspec" />
+    <None Include="QDR.FND.Infrastructure.nuspec">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="quadarax_strong_name_key.pfx" />
   </ItemGroup>
   <ItemGroup>
@@ -89,4 +94,28 @@
   </ItemGroup>
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <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('..\..\Application\qdr.app.messagepanel\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Application\qdr.app.messagepanel\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
+  </Target>
+  <Target Name="MergeAssembly" AfterTargets="Build">
+    <Message Text="*** Merging assemblies into $(TargetDir)merged\$(TargetName).dll ***" />
+	<Exec Command="if not exist &quot;$(TargetDir)merged\&quot; mkdir &quot;$(TargetDir)merged\&quot;" />
+    <Exec Command="$(ILMergeConsolePath) /out:&quot;$(TargetDir)merged\$(TargetName).dll&quot; &quot;$(TargetDir)$(TargetName).dll&quot; &quot;$(TargetDir)StructureMap.dll&quot; /keyfile:&quot;$(ProjectDir)quadarax_strong_name_key.pub&quot; /delaysign /target:library /wildcards /log:&quot;$(TargetDir)merge_output.log&quot;" />
+  </Target>
+  <Target Name="SignMergedAssembly" AfterTargets="MergeAssembly">
+	  <Message Text="*** Signing merged assembly $(TargetDir)$merged\(TargetName).dll ***" />
+	  <Exec Command="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe&quot; -Rc $(TargetDir)merged\$(TargetName).dll quadarax_strong_name_key" />
+  </Target>
+  <Target Name="CopyMergedAssembly" AfterTargets="SignMergedAssembly">
+    <Message Text="*** Replace merged assembly $(TargetDir)merged\$(TargetName).dll ***" />
+    <Exec Command="copy /Y $(TargetDir)merged\$(TargetName).dll $(TargetDir)$(TargetName).dll" />
+    <Exec Command="copy /Y $(TargetDir)merged\$(TargetName).pdb $(TargetDir)$(TargetName).pdb" />
+  </Target>
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
 </Project>

+ 12 - 2
Infrastructure/Layers/GlobalLayer.cs

@@ -1,10 +1,20 @@
-namespace Quadarax.Foundation.Infrastructure.Layers
+using StructureMap;
+
+namespace Quadarax.Foundation.Infrastructure.Layers
 {
-    public abstract class GlobalLayer : Layer
+    public class GlobalLayer : Layer
     {
         protected GlobalLayer(string name) : base(name)
         {
             LayerType = LayerClassificationEnum.Global;
         }
+
+        protected override void OnLayerRegistry()
+        {
+        }
+
+        protected override void OnModuleRegistry(IContainer container)
+        {
+        }
     }
 }

+ 9 - 0
Infrastructure/Layers/Layer.cs

@@ -44,6 +44,15 @@ namespace Quadarax.Foundation.Infrastructure.Layers
             Log.Info($"Layer '{Name}' initialization done");
         }
 
+        protected void AddChildLayer(Layer layer)
+        {
+            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.");
+        }
+
         protected abstract void OnLayerRegistry();
         
         protected abstract void OnModuleRegistry(IContainer container);

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

@@ -9,7 +9,7 @@
     <projectUrl>https://project.quadarax.com/</projectUrl>
     <iconUrl>http://project.quadarax.com/favicon.ico</iconUrl>
     <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <description>Implementations of simple infrastructure patterns (Component model).</description>
+    <description>Implementations of simple infrastructure patterns (Component model). Contains StructureMap implementation.</description>
     <releaseNotes>
       28.12.2019 v.1.0.0.0
       New
@@ -21,14 +21,13 @@
       <group targetFramework="net472">
         <dependency id="Quadarax.Foundation.Common" version="1.0.0.7"  />
         <dependency id="log4net" version="2.0.8"  />
-        <dependency id="StructureMap" version="4.7.1" />
       </group>
     </dependencies>
     <summary>Libraries</summary>
   </metadata>
   <files>
     <file src="ReleaseNote.txt" />
-    <file src="bin\Release\QDR.FND.Common.dll" target="lib\net472\QDR.FND.Common.dll" />
-	  <file src="bin\Release\QDR.FND.Common.pdb" target="lib\net472\QDR.FND.Common.pdb" />
+    <file src="bin\Release\QDR.FND.Infrastructure.dll" target="lib\net472\QDR.FND.Infrastructure.dll" />
+	  <file src="bin\Release\QDR.FND.Infrastructure.pdb" target="lib\net472\QDR.FND.Infrastructure.pdb" />
   </files>
 </package>

+ 2 - 1
Infrastructure/packages.config

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="ILMerge" version="3.0.29" targetFramework="net472" />
   <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" />
+  <package id="System.Reflection.Emit.Lightweight" version="4.7.0" targetFramework="net472" />
 </packages>

BIN
Infrastructure/quadarax_strong_name_key.pub