Skip to content

Instantly share code, notes, and snippets.

@gistlyn
gistlyn / data.cs
Last active November 10, 2020 13:34
OrmLite Basic Update Examples
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@gistlyn
gistlyn / data.cs
Last active November 10, 2020 13:34
Update Existing Values Examples
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@gistlyn
gistlyn / data.cs
Last active November 10, 2020 13:34
Update Existing Values Examples
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@gistlyn
gistlyn / data.cs
Last active November 10, 2020 13:35
Deleting multiple rows examples
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@gistlyn
gistlyn / data.cs
Last active November 10, 2020 13:35
Deleting multiple rows examples
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:35
Customize Tables using Attributes
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:35
Create Tables with Complex Types
using System.Collections.Generic;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open();
public class ArtistWithBlobTracks
@gistlyn
gistlyn / main.cs
Last active November 10, 2020 13:35
Create Tables with Foreign Keys
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:35
Create Tables with Foreign Keys
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:35
Modify Table Schema Examples
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();