FluentDbTools provides a fluent SQL abstraction layer for creating database connections, building sql queries and migrating your database.
Following databases are currently supported:
- Oracle
- Postgres
- FluentDbTools.Extensions.DbProvider:
- FluentDbTools.Extensions.SqlBuilder:
- FluentDbTools.Extensions.Migration:
- FluentDbTools.Extension.MSDependencyInjection:
- FluentDbTools.Extension.MSDependencyInjection.Oracle:
- FluentDbTools.Extension.MSDependencyInjection.Postgres:
The IDbConfig
interface is the only member you need to instantiate.
It provides a simple interface for providing which database type to use, and other necessary database settings.
IDbConfig dbConfig = new DbConfig(..)
var dbConnection = dbConfig.CreateDbConnection();
IDbConfig dbConfig = new DbConfig(..)
var sql = dbConfig.CreateSqlBuilder().Select()
.OnSchema()
.Fields<Person>(x => x.F(item => item.Id))
.Fields<Person>(x => x.F(item => item.SequenceNumber))
.Fields<Person>(x => x.F(item => item.Username))
.Fields<Person>(x => x.F(item => item.Password))
.Where<Person>(x => x.WP(item => item.Id))
.Build();
[Migration(1, "Migration Example")]
public class AddPersonTable : MigrationModel
{
public override void Up()
{
Create.Table(Table.Person).InSchema(SchemaName)
.WithColumn(Column.Id).AsGuid().PrimaryKey()
.WithColumn(Column.SequenceNumber).AsInt32().NotNullable()
.WithColumn(Column.Username).AsString()
.WithColumn(Column.Password).AsString()
.WithTableSequence(this);
}
public override void Down()
{
Delete.Table(Table.Person).InSchema(SchemaName);
}
}
Please have a look in the example folder:
- Install Docker
- Install Python and pip
- Windows: https://matthewhorne.me/how-to-install-python-and-pip-on-windows-10/
- Ubuntu: Python is installed by default
- Install pip: sudo apt-get install python-pip
- Install python dependencies:
- pip install DockerBuildManagement
- See available commands:
dbm -help
- Start domain development by deploying service dependencies:
dbm -swarm -start
- Test solution in containers:
dbm -test
- Open solution and continue development:
- Publish new nuget version:
- Bump version in CHANGELOG.md
- Build and publish nugets:
dbm -build -run -publish
- Stop development when you feel like it:
dbm -swarm -stop