Exemplo n.º 1
0
        private static void SeedDatabase()
        {
            using (var connection = ShoppingDbConnection.GetConnection())
            {
                connection.Execute(@"
CREATE TABLE IF NOT EXISTS [test_table] (
    [Id] INTEGER NOT NULL PRIMARY KEY,
    [name] NVARCHAR(50) NOT NULL
)");
                var records = connection.ExecuteScalar <int>(@"SELECT count(*) FROM [test_table]");
                if (records == 0)
                {
                    InitTablesData(connection);
                }
            }
        }
Exemplo n.º 2
0
 public static void InitDatabase()
 {
     ShoppingDbConnection.InitAndCreate();
     SeedDatabase();
 }