Пример #1
0
        private static void CreateDatabaseFromJson(string dbFileName)
        {
            //CleverWeather.SiteListUtils.ForecastTest(System.Console.Out);
            var connection = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.Win32.SQLitePlatformWin32(), dbFileName);

            //Create tables and populate city table if needed
            if (connection.RowCount <City>() == 0)
            {
                //Create tables
                connection.CreateTable <City>();
                connection.CreateTable <CurrentConditions>();
                connection.CreateTable <Forecast>();

                var assembly = System.Reflection.Assembly.GetAssembly(typeof(CleverWeather.SiteListUtils));
                connection.InsertAll(CleverWeather.SiteListUtils.GetEmbeddedCitiesResource(assembly), typeof(City));
            }
        }