If I have say for example 100,000 rows to insert/update/delete, and this number will grow constantly. Which of the following is the best approach, or does it not make any difference.
The PeopleRepository AddPeople implementation
public void AddPeople(IEnumerable i)
{
_Database.people.InsertAllOnSubmit(i);
}
The PeopleRepository AddPerson implementation
public void AddPerson(Person p)
{
_Database.people.InsertOnSubmit(p);
}
The PeopleRepository Save implementation
public void Save()
{
_Database.SubmitChanges();
}
InsertAllOnSubmit Implementation
PeopleRepository repo = new PeopleRepository();
List<Person> everyone = new List<Person>();
foreach (var p in myObject.GetPeople())
{
Person person = new Person
{
person.Name = p.Name
};
everyone.Add(person);
}
repo.AddPeople(everyone);
repo.Save();
InsertOnSubmit Implementation
PeopleRepository repo = new PeopleRepository();
foreach (var p in myObject.GetPeople())
{
Person person = new Person
{
person.Name = p.Name
};
repo.AddPerson(person);
repo.Save();
}