private string ResolveConnectionString(DatabaseOptions database)
        {
            if (database.ConnectionString.HasValue())
            {
                return(database.ConnectionString);
            }

            if (database.UserSecretsId.HasValue())
            {
                var secretsStore = new SecretsStore(database.UserSecretsId);
                if (secretsStore.ContainsKey(database.ConnectionName))
                {
                    return(secretsStore[database.ConnectionName]);
                }
            }

            throw new InvalidOperationException("Could not find connection string.");
        }
        private GeneratorOptions CreateUserSecret(GeneratorOptions options)
        {
            if (options.Database.UserSecretsId.IsNullOrWhiteSpace())
            {
                options.Database.UserSecretsId = Guid.NewGuid().ToString();
            }

            if (options.Database.ConnectionName.IsNullOrWhiteSpace())
            {
                options.Database.ConnectionName = "ConnectionStrings:Generator";
            }

            Logger.LogInformation("Adding Connection String to User Secrets file");

            // save connection string to user secrets file
            var secretsStore = new SecretsStore(options.Database.UserSecretsId);

            secretsStore.Set(options.Database.ConnectionName, ConnectionString);
            secretsStore.Save();

            return(options);
        }