OwenMcDonnell / crossql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crossql

A Portable, cross-platform, light weight, opinionated ORM designed to work across multiple Databases


Build Status

Stable Build (master) Pre-Release Build (vnext)
(coming soon) Build status

Packages

Provider Package Name Stable Pre-Release
crossql.core MyGet
SQLite crossql.sqlite MyGet
MS Sql Server crossql.mssqlserver MyGet

Current Support

note: we take pull requests if you'd like to support more ;)

Platform Sqlite SQL Server (>= 2012) PostgreSQL MySQL
Windows
Android
iOS

That sounds good, how do I use it?

Create

var jill = new StudentModel
    {
        Id = StudentJillId,
        FirstName = "Jill",
        LastName = "",
        Email = JillEmail,
        Courses = new List<CourseModel> { englishCourse },
    };

await _dbProvider.Create( jill );

Read

IList<StudentModel> allStudents = await _dbProvider.Query<StudentModel>().ToListAsync();
StudentModel jill = await _dbProvider.Query<StudentModel>().Where(s => s.Email == "JillEmail").FirstOrDefaultAsync();

Update

jill.Email = "JillNewEmail";
await _dbProvider.Update<StudentModel>(jill);

Delete
note: this is still a work in progress

// first flavor
await _dbProvider.Query<StudentModel>().Where( s => s.Email == "JillNewEmail" ).Delete();

// second flavor
await _dbProvider.Delete<StudentModel>(s => s.Email == "JillNewEmail");

Meta

We absolutely welcome contributions/suggestions/bug reports from you (the people using this package). If you have any ideas on how to improve it, please post an issue with steps to reproduce, or better yet, submit a Pull Request.

crossql is forked from futurestate.appcore.data. Commit history is in tact.

About

License:Microsoft Public License


Languages

Language:C# 96.2%Language:PowerShell 2.6%Language:Shell 1.2%