Example #1
0
        public virtual async Task <SqlConnectionStringBuilder> CreateAsync(IStorageConnectionStringSettings settings, IContext ctx = default)
        {
            settings.EnsureNotNull(nameof(settings)).EnsureReadOnly().EnsureValid();
            //
            SqlConnectionStringBuilder builder;

            if (settings.SkipSecretTextSubstitution)
            {
                CreateBuilder(sourceConnectionString: await settings.GetConnectionStringRawAsync(ctx: ctx).ConfigureAwait(false), builder: out builder, ctx: ctx);
            }
            else
            {
                ctx.ThrowIfCancellationRequested();
                var secretTextHandler = ServiceProvider.GetRequiredService <ISecretTextSubstitutionHandler>();
                var connectionString  = await secretTextHandler.SubstituteAsync(template : await settings.GetConnectionStringRawAsync(ctx : ctx).ConfigureAwait(false), ctx : ctx).ConfigureAwait(false);

                CreateBuilder(sourceConnectionString: connectionString, builder: out builder, ctx: ctx);
            }
            return(builder);
        }
Example #2
0
 public virtual bool CanCreate(IStorageConnectionStringSettings settings)
 {
     settings.EnsureNotNull(nameof(settings)).EnsureReadOnly().EnsureValid();
     //
     return(true);
 }