/// <summary> /// Batch inserts a collection of <c>Company</c> objects. /// </summary> /// <param name="companies"></param> public void Insert(IEnumerable <Company> companies) { using (var conn = new NpgsqlConnection(dbAccess.connectionString)) { using (var db = new NPoco.Database(conn)) { db.Connection.Open(); db.InsertBatch <CompanyDto>(CompanyDto.Translate(companies.ToList())); db.Connection.Close(); } } }