Esempio n. 1
0
 /// <summary>
 /// Batch inserts a collection of <c>Location</c> objects.
 /// </summary>
 /// <param name="locations"></param>
 public void Insert(IEnumerable <Location> locations)
 {
     using (var conn = new NpgsqlConnection(dbAccess.connectionString))
     {
         using (var db = new NPoco.Database(conn))
         {
             db.Connection.Open();
             db.InsertBatch <LocationDto>(LocationDto.Translate(locations.ToList()));
             db.Connection.Close();
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Batch inserts a collection of <c>Target</c> objects.
 /// </summary>
 /// <param name="targets"></param>
 public void Insert(IEnumerable <Target> targets)
 {
     using (var conn = new NpgsqlConnection(dbAccess.connectionString))
     {
         using (var db = new NPoco.Database(conn))
         {
             db.Connection.Open();
             db.InsertBatch <TargetDto>(TargetDto.Translate(targets.ToList()));
             db.Connection.Close();
         }
     }
 }