Skip to content

Instantly share code, notes, and snippets.

@gistlyn
gistlyn / index.md
Last active July 29, 2016 07:12
OrmLite CREATE Table Examples

CREATE Table Examples

As a code-first ORM, creating tables is effortless in OrmLite that uses your POCO Type definition to generate RDBMS Table schemas that cleanly maps .NET data types 1:1 to the most appropriate RDBMS column definition:

OrmLite also supports persisting rich complex types which are blobbed by default or you can use the [Reference] support to persist Nested Complex Types in their own Table Definitions:

@gistlyn
gistlyn / index.md
Last active July 29, 2016 07:10
Modify Table Schema Examples

Modify Schema Examples

OrmLite provides Typed APIs for modifying Table Schemas that makes it easy to inspect the state of an RDBMS Table which can be used to determine what modifications you want to apply to it to upgrade it to the latest version:


@gistlyn
gistlyn / index.md
Created July 26, 2016 05:36
OrmLite Custom SQL Examples

Custom SQL Examples

@gistlyn
gistlyn / index.md
Last active July 31, 2016 22:04
OrmLite's Miscellaneous Features

Coming Soon!

You can also view OrmLite's Documentation to learn about these features now.

Other Features

Async APIs

@gistlyn
gistlyn / index.md
Last active January 1, 2024 14:34
Interactive Tour of OrmLite

is a fast, simple, typed code-first ORM for .NET supporting most popular RDBMS's. For this interactive tour we'll use OrmLite's cross-platform In Memory SQLite database which can be referenced in Gistlyn by copying the packages.config NuGet generates after it installs it with:

> Install-Package ServiceStack.OrmLite.Sqlite

A copy of packages.config and test data.cs most examples use is available in:

@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:32
Simple OrmLite CRUD demo (async)
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
/*** OrmLite Async:
* Most of OrmLite's public APIs have async equivalents of the same name with an
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:34
Insert records with AutoIncrement Ids
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open();
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:34
Insert records with AutoIncrement Ids
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open();
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:34
OrmLite Save API
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:34
Insert partial records
using System;
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);