Skip to content

Instantly share code, notes, and snippets.

@Dynalon
Created May 7, 2013 12:35
Show Gist options
  • Save Dynalon/5532235 to your computer and use it in GitHub Desktop.
Save Dynalon/5532235 to your computer and use it in GitHub Desktop.
using System;
using ServiceStack.OrmLite;
using System.IO;
namespace ormlitebug
{
class MainClass
{
public static void Main (string[] args)
{
var factory = new OrmLiteConnectionFactory ("sqlite.db", SqliteDialect.Provider);
using (var db = factory.OpenDbConnection ()) {
db.DropAndCreateTable<SamplePoco> ();
var toDb = new SamplePoco () { TheTime = new DateTime (1990, 1, 1, 0, 0, 0, DateTimeKind.Utc) };
db.Insert<SamplePoco> (toDb);
var fromDb = db.Select<SamplePoco> ()[0];
var fromDbUtc = fromDb.TheTime.ToUniversalTime ();
var toDbUtc = toDb.TheTime.ToUniversalTime ();
if (fromDbUtc != toDbUtc)
throw new Exception ();
}
}
}
public class SamplePoco
{
public DateTime TheTime { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment