예제 #1
0
    public static async Task CreateDatabaseAsync(string connectionString, int pageSize = 4096, bool forcedWrites = true, bool overwrite = false, CancellationToken cancellationToken = default)
    {
        var options = new ConnectionString(connectionString);

        options.Validate();

        try
        {
            var db = new FbConnectionInternal(options);
            try
            {
                await db.CreateDatabaseAsync(pageSize, forcedWrites, overwrite, cancellationToken).ConfigureAwait(false);
            }
            finally
            {
                await db.DisconnectAsync(cancellationToken).ConfigureAwait(false);
            }
        }
        catch (IscException ex)
        {
            throw FbException.Create(ex);
        }
    }