Skip to content

Extends the functionality of Dapper and allows performing database queries in .NET easily and quickly.

License

Notifications You must be signed in to change notification settings

wayfair-incubator/Gossip

Gossip

Gossip Version OSS Template Version Contributor Covenant

About The Project

Gossip extends the functionality of Dapper and allows you to perform database queries in .NET quickly and easily, working with your relational database system of choice (MSSQL, MySQL, PostgreSQL, SQLite, Oracle, etc). The package is designed for ease of working with single or batched queries, bulk inserts, and transactions. Want to go deeper? Gossip also supports custom plugins and execution strategies to handle events just the way you want them.

Installation

Install the latest version from NuGet.

// NuGet package manager console
Install-Package Gossip

Usage

To get started, configure and build a database connection. Database offers a number of build options, including adding plugins and/or execution strategies if desired.

var _dbConnectionProvider = Database
  .Configure()
  .WithCommandTimeout(gossipConfiguration.DefaultSqlCommandTimeout)
  .WithConnectionString(() => {
    return new ConnectionString {
      Value = connectionString,
      Server = server,
      Database = database,
    };
  })
  .Build();

Open an asynchronous connection.

using (var conn = await _provider.OpenAsync(cancellationToken)) {
  var results = await conn.QueryAsync<T>(sql);
}

For simple queries, take advantage of some of the quick and easy methods outlined below.

await conn.QueryAsync<T>(sql);
await conn.QueryAsync<T>(sql, params);
await conn.QueryFirstOrDefaultAsync<T>(sql);
await conn.QueryFirstOrDefaultAsync<T>(sql, params);
await conn.QuerySingleOrDefaultAsync<T>(sql);
await conn.QuerySingleOrDefaultAsync<T>(sql, params);
await conn.ExecuteAsync(sql, params);

For more detailed examples, consult the documentation.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. For detailed contributing guidelines, please see CONTRIBUTING.md

License

Distributed under the Apache 2.0 License. See LICENSE for more information.