diff --git a/src/Moryx.Runtime.Kernel/HeartOfGold.cs b/src/Moryx.Runtime.Kernel/HeartOfGold.cs index 9d317fcb0..2ef2af780 100644 --- a/src/Moryx.Runtime.Kernel/HeartOfGold.cs +++ b/src/Moryx.Runtime.Kernel/HeartOfGold.cs @@ -19,7 +19,7 @@ namespace Moryx.Runtime.Kernel /// /// Base kernel loader for the runtime /// - public class HeartOfGold + public class HeartOfGold : IApplicationRuntime { private string[] _args; @@ -27,19 +27,17 @@ public class HeartOfGold /// Current global container /// private IContainer _container; + + /// + public IContainer GlobalContainer => _container; + /// /// Creates an instance of the /// public HeartOfGold(string[] args) { PrepareArguments(args); - } - /// - /// Starts the runtime - /// - public RuntimeErrorCode Run() - { // Set working directory to location of this exe // ReSharper disable once AssignNullToNotNullAttribute Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); @@ -55,7 +53,13 @@ public RuntimeErrorCode Run() // Prepare container _container = CreateContainer(); + } + /// + /// Starts the runtime + /// + public RuntimeErrorCode Run() + { // Load and run environment var loadResult = LoadEnvironment(out var env); var returnCode = RuntimeErrorCode.NoError; diff --git a/src/Moryx/IApplicationRuntime.cs b/src/Moryx/IApplicationRuntime.cs new file mode 100644 index 000000000..63781b9a9 --- /dev/null +++ b/src/Moryx/IApplicationRuntime.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2021, Phoenix Contact GmbH & Co. KG +// Licensed under the Apache License, Version 2.0 + +using Moryx.Container; + +namespace Moryx +{ + /// + /// Interface for application executables like HeartOfGold or HeartOfLead + /// + public interface IApplicationRuntime + { + /// + /// Top Level container + /// + IContainer GlobalContainer { get; } + } +} \ No newline at end of file