Beispiel #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);
        }
Beispiel #2
0
 ITaskWrap <SqlConnectionStringBuilder> IOptionalFactory <IStorageConnectionStringSettings, SqlConnectionStringBuilder> .CreateAsync(IStorageConnectionStringSettings settings, IContext ctx)
 => CreateAsync(settings: settings, ctx: ctx).Wrap();
Beispiel #3
0
 public virtual SqlConnectionStringBuilder Create(IStorageConnectionStringSettings settings, IContext ctx = default)
 => CreateAsync(settings: settings, ctx: ctx).WaitResultWithTimeout();
Beispiel #4
0
 public virtual bool CanCreate(IStorageConnectionStringSettings settings)
 {
     settings.EnsureNotNull(nameof(settings)).EnsureReadOnly().EnsureValid();
     //
     return(true);
 }