private SQLiteConnection GetDatabaseConnection() { var documents = Environment.GetFolderPath (Environment.SpecialFolder.Desktop); string db = Path.Combine (documents, "Occupation.db3"); OccupationModel Occupation; // Create the database if it doesn't already exist bool exists = File.Exists (db); // Create connection to database var conn = new SQLiteConnection (db); // Initially populate table? if (!exists) { // Yes, build table conn.CreateTable<OccupationModel> (); // Add occupations Occupation = new OccupationModel ("Documentation Manager", "Manages the Documentation Group"); conn.Insert (Occupation); Occupation = new OccupationModel ("Technical Writer", "Writes technical documentation and sample applications"); conn.Insert (Occupation); Occupation = new OccupationModel ("Web & Infrastructure", "Creates and maintains the websites that drive documentation"); conn.Insert (Occupation); Occupation = new OccupationModel ("API Documentation Manager", "Manages the API Doucmentation Group"); conn.Insert (Occupation); Occupation = new OccupationModel ("API Documentor", "Creates and maintains API documentation"); conn.Insert (Occupation); } return conn; }
private SQLiteConnection GetDatabaseConnection() { var documents = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string db = Path.Combine(documents, "Occupation.db3"); OccupationModel Occupation; // Create the database if it doesn't already exist bool exists = File.Exists(db); // Create connection to database var conn = new SQLiteConnection(db); // Initially populate table? if (!exists) { // Yes, build table conn.CreateTable <OccupationModel> (); // Add occupations Occupation = new OccupationModel("Documentation Manager", "Manages the Documentation Group"); conn.Insert(Occupation); Occupation = new OccupationModel("Technical Writer", "Writes technical documentation and sample applications"); conn.Insert(Occupation); Occupation = new OccupationModel("Web & Infrastructure", "Creates and maintains the websites that drive documentation"); conn.Insert(Occupation); Occupation = new OccupationModel("API Documentation Manager", "Manages the API Doucmentation Group"); conn.Insert(Occupation); Occupation = new OccupationModel("API Documentor", "Creates and maintains API documentation"); conn.Insert(Occupation); } return(conn); }