void IUnitOfWork <T> .Complete() { using (DbConnection con = DbFactory.CreateAndOpenConnection(_connectionString)) { this.Complete(con); } }
private void InitRoles(ICollection <string> serverRoles) { using (DbConnection con = _dbFactory.CreateAndOpenConnection(_connectionString)) { using (DbCommand insert = con.CreateCommand()) { int i = 0; insert.CommandText = "INSERT OR IGNORE INTO Roles(name) VALUES"; foreach (string role in serverRoles) { insert.AddParameterWithValue($"role{i}", role); insert.CommandText += (i < serverRoles.Count - 1) ? $"(@role{i})," : $"(@role{i})"; i++; } insert.ExecuteNonQuery(); } } }