All Projects → Oceania2018 → Entityframeworkcore.bootkit

Oceania2018 / Entityframeworkcore.bootkit

Licence: mit
EntityFrameworkCore Start Kit

Projects that are alternatives of or similar to Entityframeworkcore.bootkit

Fluentmigrator
Fluent migrations framework for .NET
Stars: ✭ 2,636 (+8989.66%)
Mutual labels:  database, postgres, redshift
Otj Pg Embedded
Java embedded PostgreSQL component for testing
Stars: ✭ 559 (+1827.59%)
Mutual labels:  database, postgres
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (+19141.38%)
Mutual labels:  database, postgres
Blog
Everything about database,business.(Most for PostgreSQL).
Stars: ✭ 6,330 (+21727.59%)
Mutual labels:  database, postgres
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+15406.9%)
Mutual labels:  database, postgres
Gnorm
A database-first code generator for any language
Stars: ✭ 415 (+1331.03%)
Mutual labels:  database, postgres
Rein
Database constraints made easy for ActiveRecord.
Stars: ✭ 657 (+2165.52%)
Mutual labels:  database, postgres
Crecto
Database wrapper and ORM for Crystal, inspired by Ecto
Stars: ✭ 325 (+1020.69%)
Mutual labels:  database, postgres
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 7,712 (+26493.1%)
Mutual labels:  database, postgres
Efcore.pg
Entity Framework Core provider for PostgreSQL
Stars: ✭ 838 (+2789.66%)
Mutual labels:  database, postgres
Docker Postgres
A docker container running PostgreSQL
Stars: ✭ 22 (-24.14%)
Mutual labels:  database, postgres
Jet
Type safe SQL builder with code generation and automatic query result data mapping
Stars: ✭ 373 (+1186.21%)
Mutual labels:  database, postgres
Tgbot
Modular telegram group management bot
Stars: ✭ 334 (+1051.72%)
Mutual labels:  database, postgres
Zero downtime migrations
Zero downtime migrations with ActiveRecord 3+ and PostgreSQL
Stars: ✭ 513 (+1668.97%)
Mutual labels:  database, postgres
Rdbc
Rust DataBase Connectivity (RDBC) :: Common Rust API for database drivers
Stars: ✭ 328 (+1031.03%)
Mutual labels:  database, postgres
Pgmetrics
Collect and display information and stats from a running PostgreSQL server
Stars: ✭ 612 (+2010.34%)
Mutual labels:  database, postgres
Go Kallax
Kallax is a PostgreSQL typesafe ORM for the Go language.
Stars: ✭ 853 (+2841.38%)
Mutual labels:  database, postgres
Ansible Role Postgresql
Ansible Role - PostgreSQL
Stars: ✭ 310 (+968.97%)
Mutual labels:  database, postgres
Architect
A set of tools which enhances ORMs written in Python with more features
Stars: ✭ 320 (+1003.45%)
Mutual labels:  database, postgres
Metabase
The simplest, fastest way to get business intelligence and analytics to everyone in your company 😋
Stars: ✭ 26,803 (+92324.14%)
Mutual labels:  database, postgres

EntityFrameworkCore.BootKit

Join the chat at https://gitter.im/publiclab/publiclab Documentation Status NuGet

EntityFrameworkCore Boot Kit (EFBK) is a quick start database connect library for using .NET EntityFrameworkCore.

Features:

  • Inherits from EntityFrameworkCore Triggers to enable entries update notfication.
  • Support mulitple databases like MySql, SQL Server, Sqlite, PostgreSql, MongoDB, Amazon Redshift, AWS Aurora and InMemory.
  • Support dynamic linq to query and update database.
  • Support read/write seperated mode. Randomly choose multiple slaves.
  • Multiple database with distributed transaction supported, and MySQL multiple databases/tables sharding supported.
  • Tracking entry change history.
  • Built-in DbFactory with access control list (ACL) hook.

Get started

How to install

PM> Install-Package EntityFrameworkCore.BootKit

How to use

  1. Define entity
  public class PizzaOrder : DbRecord, IDbRecord
  {
	[MaxLength(32)]
	public String OrderNumber { get; set; } 

	[MaxLength(64)]
	public String CustomerName { get; set; }
	
	[Required]
	public DateTime CreatedTime { get; set; }
	
	[ForeignKey("OrderId")]
	public List<PizzaType> PizzaTypes { get; set; }
  }
  1. Init data context
  var db = new Database();
  AppDomain.CurrentDomain.SetData("Assemblies", new string[] { "EntityFrameworkCore.BootKit.UnitTest" });

  // bind as much data context as you can
  db.BindDbContext<IDbRecord, DbContext4Sqlite>(new DatabaseBind
  {
	MasterConnection = new SqliteConnection($"Data Source={Directory.GetCurrentDirectory()}\\..\\..\\..\\..\\bootkit.db"),
	CreateDbIfNotExist = true
  });

  db.BindDbContext<IDbRecord, DbContext4PostgreSql>(new DatabaseBind
  {
      MasterConnection = new NpgsqlConnection("Server=; Port=5439;User ID=;Password=;Database=;SSL Mode=Require;Trust Server Certificate=True;Use SSL Stream=True"),
  });
  1. Retrieve record
  var order = db.Table<PizzaOrder>().Include(x => x.PizzaTypes).FirstOrDefault();
  1. Retrieve record by table name
  var table = db.Table("PizzaOrder");
  var pizzaOrder = table.First() as PizzaOrder;
  1. Update record in transaction
  int row = db.DbTran(() =>
  {
    var po = db.Table<PizzaOrder>().Find(PIZZA_ORDER_ID);
    po.CreatedTime = DateTime.UtcNow
  });
  1. Update record in Patch function
  int row = db.DbTran(() =>
  {
	var patch = new DbPatchModel
	{
		Table = "PizzaOrder",
		Id = PIZZA_ORDER_ID
	};

	patch.Values.Add("CreatedTime", dt);
	db.Patch<IDbRecord>(patch);
  });
  1. Implement IRequireDbPermission to interupt update
  2. View raw sql
  string sql = table.ToSql();
  1. Added MongoDb support
  db.BindDbContext<IDbRecord, DbContext4MongoDb>(new DatabaseBind
  {
	MasterConnection = new MongoDbConnection("mongodb://user:[email protected]:27017/db"),
  });
  var collection = db.Collection<MongoDbCollectionTest>().FirstOrDefault();
  1. Support Amazon Redshift
  db.BindDbContext<IDbRecord, DbContext4Redshift>(new DatabaseBind
  {
      string connString = "Server=*.us-east-1.redshift.amazonaws.com; Port=5439;User ID=;Password=;Database=;Server Compatibility Mode=Redshift;SSL Mode=Require;Trust Server Certificate=True;Use SSL Stream=True";
      MasterConnection = new NpgsqlConnection(connString),
  });

Documentation

https://entityframeworkcorebootkit.readthedocs.io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].