Ejemplo n.º 1
0
        public async Task Run(XConsole xc)
        {
            try
            {
                using (var scope = xc.WebHost.Services.CreateScope())
                {
                    var settings = scope.ServiceProvider.GetService <IDbService <SystemSetting> >();
                    var name     = settings.FindSingleWhere(x => x.SettingName == CORE_SYSTEM_SETTING_NAMES.APP_NAME.ToString());

                    if (name != null)
                    {
                        Console.Title = $"X-Console  -  {name.Value}";
                        xc.SetPromptString($"{name.Value}:>> ");
                    }
                    else
                    {
                        xc.WriteError(this, "App name is not set in the db.");
                    }
                }
            }
            catch (Exception ex)
            {
                xc.WriteException(this, ex);
            }
        }