Example #1
0
        private static void SingelThread_SQLite()
        {
            var dbFactory = new OrmLiteConnectionFactory(
                "App_Data/db.sqlite", SqliteDialect.Provider);

            using (IDbConnection db = dbFactory.Open()) {
                db.DropAndCreateTable <StringPOCO>();
                Console.WriteLine("SingelThread_SQLite");
                Stopwatch sw = Stopwatch.StartNew();
                for (int i = 0; i < 1000; i++)
                {
                    string key  = Guid.NewGuid().ToString();
                    var    poco = new StringPOCO()
                    {
                        Key   = key,
                        Value = key,
                    };
                    db.Save(poco);
                    var savedpoco = db.SingleById <StringPOCO>(key);
                    if (savedpoco.Value != key)
                    {
                        throw new Exception();
                    }
                }
                sw.Stop();
                Console.WriteLine(sw.Elapsed);
            }
        }
Example #2
0
 private static void SingelThread_SQLite()
 {
     var dbFactory = new OrmLiteConnectionFactory(
     "App_Data/db.sqlite", SqliteDialect.Provider);
     using (IDbConnection db = dbFactory.Open()) {
         db.DropAndCreateTable<StringPOCO>();
         Console.WriteLine("SingelThread_SQLite");
         Stopwatch sw = Stopwatch.StartNew();
         for (int i = 0; i < 1000; i++) {
             string key = Guid.NewGuid().ToString();
             var poco = new StringPOCO() {
                 Key = key,
                 Value = key,
             };
             db.Save(poco);
             var savedpoco = db.SingleById<StringPOCO>(key);
             if (savedpoco.Value != key) throw new Exception();
         }
         sw.Stop();
         Console.WriteLine(sw.Elapsed);
     }
 }