override public IEnumerable <User> GetAll() { using (var connection = GetConnection()) { try { string sql = "SELECT Id, Name FROM User;"; connection.Open(); var allUsers = new List <User>(); using (var command = new SqliteCommand(sql, connection)) { command.CommandText = sql; command.CommandType = CommandType.Text; var reader = command.ExecuteReader(); while (reader.Read()) { allUsers.Add(new User( reader.GetFieldValue <string>("Name"), reader.GetFieldValue <int>("Id"))); } } return(allUsers); } catch (Exception e) { Console.WriteLine("!!!" + DbUtilityHelper.GetConnectionInfo(connection)); throw e; } } }
public TaskManager(UserManager userManager) { this.connection = DbUtilityHelper.GetConnection(); this.userManager = userManager; }
private static SqliteConnection GetConnection() { return(DbUtilityHelper.GetConnection()); }
public SQLite3Store() { this.connection = DbUtilityHelper.GetConnection(); this.userManager = new UserManager(); this.taskManager = new TaskManager(userManager); }
public UserManager() { connection = DbUtilityHelper.GetConnection(); Console.WriteLine(connection.DataSource.ToString()); }
protected SqliteConnection GetConnection() { return(DbUtilityHelper.GetConnection()); }