Merge branch 'master' into v3.1
大石头 authored at 2024-07-13 19:03:18
830.00 B
Stardust
using System.Threading;
using System.Threading.Tasks;
using Stardust.Data;

namespace StarGateway
{
    class InitService : IHostedService
    {
        public Task StartAsync(CancellationToken cancellationToken)
        {
            //await Task.Yield();

            Task.Run(() =>
            {
                // 配置
                var set = NewLife.Setting.Current;
                if (set.IsNew)
                {
                    set.DataPath = "../Data";
                    set.Save();
                }

                // 初始化数据库
                var n = App.Meta.Count;
                //AppStat.Meta.Session.Dal.Db.ShowSQL = false;
            });

            return Task.CompletedTask;
        }

        public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
    }
}