IvyORM

IvyORM is an extremely simple yet powerful ORM/Micro-ORM/MicroORM that extends DbConnection and DbTransaction. With IvyORM boilerplate code is reduced while keeping SQL a first class citizen.

Can be installed searching NuGet for IvyORM
Change History

Goals:

Example

using IvyOrm;
using System.Data.SQLite;
using System.Diagnostics;

namespace Example
{
    class Person
    {
        [PrimaryKey(PrimaryKeyOptions.ReturnKeyValueOnInsert)]
        public int PersonID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }

    class Test
    {
        public void ExampleMethod()
        {
            //Supports any ADO.NET DbConnection
            using (var connection = new SQLiteConnection("...")) 
            {
                connection.Open();

                //Execute any Arbitrary SQL
                connection.ExecuteNonQuery("delete from TableA where ColumnA = @1", 12);

                //Insert records
                Person person = new Person { FirstName = "John", LastName = "Smith" };
                connection.RecordInsert(person);
                Debug.Assert(person.PersonID != 0); //PrimaryKey's value is returned

                //Selects an array
                Person[] people = connection.RecordQuery<Person>("select * from Person");

                //Select a single record
                person = connection.RecordSingle<Person>(@"select * from Person 
                                                           where LastName=@1", "Doe");

                //Updates
                person.LastName = "Roe";
                connection.RecordUpdate(person);

                //Executes a delete based off the primary key
                person = new Person { PersonID = 10 };
                connection.RecordDelete(person); 
            }
        }
    }
}