2022-10-13 14:22:20 +05:00
|
|
|
|
using DocumentFormat.OpenXml.InkML;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2022-01-17 15:33:00 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2021-12-02 11:11:14 +05:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2021-12-02 11:11:14 +05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudWebApi
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
2022-04-11 18:00:34 +05:00
|
|
|
|
// Uncomment next line to find wired exceptions by tracing.
|
|
|
|
|
//static TraceListenerView trace4debug = new TraceListenerView();
|
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
2022-01-17 15:33:00 +05:00
|
|
|
|
IConfigurationRoot configuration = new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
|
|
|
|
.AddJsonFile("appsettings.json")
|
|
|
|
|
.Build();
|
|
|
|
|
|
2022-04-11 18:00:34 +05:00
|
|
|
|
if (args?.Length > 0)
|
2021-12-02 11:11:14 +05:00
|
|
|
|
{
|
2022-04-11 18:00:34 +05:00
|
|
|
|
if (args.Contains("db_init"))
|
|
|
|
|
{
|
2021-12-02 11:11:14 +05:00
|
|
|
|
var connectionStringName = "DefaultConnection";
|
|
|
|
|
|
2022-10-13 14:22:20 +05:00
|
|
|
|
var context = AsbCloudInfrastructure.DependencyInjection.MakeContext(configuration.GetConnectionString(connectionStringName));
|
|
|
|
|
context.Database.SetCommandTimeout(TimeSpan.FromSeconds(5 * 60));
|
|
|
|
|
context.Database.Migrate();
|
|
|
|
|
|
2021-12-02 11:11:14 +05:00
|
|
|
|
Console.WriteLine("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
WriteHelp();
|
2021-12-02 11:24:54 +05:00
|
|
|
|
return;
|
2022-04-11 18:00:34 +05:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-17 15:33:00 +05:00
|
|
|
|
var host = CreateHostBuilder(args).Build();
|
|
|
|
|
AsbCloudInfrastructure.Startup.BeforeRunHandler(host, configuration);
|
|
|
|
|
host.Run();
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
|
|
|
Host.CreateDefaultBuilder(args)
|
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
|
|
|
{
|
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
|
|
|
});
|
2021-12-02 11:11:14 +05:00
|
|
|
|
|
|
|
|
|
private static void WriteHelp()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
Console.WriteLine("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
Console.WriteLine("db_init - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
Console.WriteLine("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"DefaultConnection\"");
|
|
|
|
|
Console.WriteLine("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>");
|
|
|
|
|
Console.WriteLine("<22> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>.");
|
|
|
|
|
Console.WriteLine("<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> public");
|
|
|
|
|
Console.WriteLine("");
|
|
|
|
|
}
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
|
|
|
|
}
|