상속: Model.BindableBase
예제 #1
0
        public static List<Boilerplate> LoadAll()
        {
            List<Boilerplate> results = new List<Boilerplate>();

            String sqlBoilerplate = @"
                SELECT *
                FROM Boilerplate;
            ";

            using (SQLiteConnection m_dbConnection = new SQLiteConnection(Repository.ConnectionString))
            {
                m_dbConnection.Open();
                SQLiteCommand command = new SQLiteCommand(sqlBoilerplate, m_dbConnection);
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Boilerplate boilerplate = new Boilerplate();
                        boilerplate.Title = reader["title"].ToString();
                        boilerplate.Text = reader["value"].ToString();
                        boilerplate.Id = Int32.Parse(reader["item_id"].ToString());
                        results.Add(boilerplate);
                    }
                }
            }

            return results;
        }
예제 #2
0
        public static List <Boilerplate> LoadAll()
        {
            List <Boilerplate> results = new List <Boilerplate>();

            String sqlBoilerplate = @"
                SELECT * 
                FROM Boilerplate;
            ";

            using (SQLiteConnection m_dbConnection = new SQLiteConnection(Repository.ConnectionString))
            {
                m_dbConnection.Open();
                SQLiteCommand command = new SQLiteCommand(sqlBoilerplate, m_dbConnection);
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Boilerplate boilerplate = new Boilerplate();
                        boilerplate.Title = reader["title"].ToString();
                        boilerplate.Text  = reader["value"].ToString();
                        boilerplate.Id    = Int32.Parse(reader["item_id"].ToString());
                        results.Add(boilerplate);
                    }
                }
            }

            return(results);
        }