parent
88e268e1cc
commit
5b1cadc553
@ -0,0 +1,67 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using TomPIT.Connected.Configuration;
|
||||||
|
|
||||||
|
namespace TomPIT.Connected
|
||||||
|
{
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main(params string[] args)
|
||||||
|
{
|
||||||
|
SysConfiguration.Build();
|
||||||
|
|
||||||
|
Start(ParseArguments(args));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Start(Dictionary<string, string> args)
|
||||||
|
{
|
||||||
|
foreach (var microService in SysConfiguration.MicroServices)
|
||||||
|
LoadMicroServiceAssembly(microService);
|
||||||
|
|
||||||
|
if (Type.GetType(SysConfiguration.Start) is not Type startupType)
|
||||||
|
throw new Exception($"Cannot resolve startup type. ({SysConfiguration.Start}).");
|
||||||
|
|
||||||
|
if (startupType.GetMethod("ConfigureAsync", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) is not MethodInfo configureMethod)
|
||||||
|
throw new Exception($"ConfigureAsync does not exists in the startup type {startupType}. Startup must have static 'async Task ConfigureAsync(params string[] args)' method.");
|
||||||
|
|
||||||
|
if (configureMethod.Invoke(null, new object[] { args }) is not Task task)
|
||||||
|
throw new Exception($"ConfigureAsync of type {startupType} must return Task.");
|
||||||
|
|
||||||
|
task.ConfigureAwait(false);
|
||||||
|
|
||||||
|
task.GetType().GetProperty("Result")?.GetValue(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Assembly? LoadMicroServiceAssembly(MicroServiceDescriptor descriptor)
|
||||||
|
{
|
||||||
|
var assemblyFile = descriptor.Name.EndsWith(".dll") ? descriptor.Name : $"{descriptor.Name}.dll";
|
||||||
|
|
||||||
|
foreach (var location in SysConfiguration.Locations)
|
||||||
|
{
|
||||||
|
var assemblyPath = Path.Combine(location, assemblyFile);
|
||||||
|
|
||||||
|
if (File.Exists(assemblyPath))
|
||||||
|
return Assembly.LoadFrom(assemblyPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Assembly.Load(AssemblyName.GetAssemblyName(assemblyFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, string> ParseArguments(params string[] args)
|
||||||
|
{
|
||||||
|
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
foreach (var i in args)
|
||||||
|
{
|
||||||
|
var tokens = i.Split('=', 2);
|
||||||
|
|
||||||
|
if (tokens.Length == 1)
|
||||||
|
result.Add(tokens[0].Trim(), string.Empty);
|
||||||
|
else
|
||||||
|
result.Add(tokens[0].Trim(), tokens[1].Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"TomPIT.Connected": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "http://localhost:5063"
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Synchronize Entities": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"commandLineArgs": "entitySynchronization=rebuild"
|
||||||
|
},
|
||||||
|
"Synchronize Entity": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"commandLineArgs": "entitySynchronization=type:Logistics.Documents/Logistics.Documents.Receive.ReceivePlannedItem"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:14733",
|
||||||
|
"sslPort": 44321
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.SqlServer.Management.SqlParser" Version="160.22515.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
@ -0,0 +1,153 @@
|
|||||||
|
{
|
||||||
|
"microServices": [
|
||||||
|
{
|
||||||
|
"name": "Connected",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Caching",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Collections",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Configuration",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Data",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Entities",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Globalization",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Hosting",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Interop",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Middleware",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Net",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Notifications",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Rest",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Runtime",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Security",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.ServiceModel",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Services",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Threading",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Validation",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.Instance",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common.Model",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common.Types",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common.Types.Model",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Logistics.Documents",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Logistics.Processes.Receive",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Contacts.Types",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Logistics.Types",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Logistics.Stock",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common.Notes",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Common.Notes.Model",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.ServiceModel.Client.Data",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connected.ServiceModel.Client",
|
||||||
|
"version": "1.0.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"locations": [
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework\\Connected.Instance\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework\\Connected.Entities\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework\\Connected.Rest\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework.ServiceModel\\Connected.ServiceModel\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Common\\Common\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Common.Types\\Common.Types\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Common\\Common.Notes\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Logistics\\Logistics.Processes.Receive\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Logistics\\Logistics.Documents\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Logistics\\Logistics.Types\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Logistics\\Logistics.Stock\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Customers\\Contacts.Types\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework.ServiceModel.Client\\Connected.ServiceModel.Client\\bin\\Debug\\net7.0",
|
||||||
|
"C:\\Solutions\\TomPIT.Connected\\Framework.ServiceModel.Client\\Connected.ServiceModel.Client.Data\\bin\\Debug\\net7.0"
|
||||||
|
],
|
||||||
|
"start": "Connected.Instance.Start, Connected.Instance"
|
||||||
|
}
|
Loading…
Reference in new issue