Wednesday, June 9, 2010

PLINQ with the LINQ to Excel Provider

In .Net 4.0 there are new extensions methods to take advantage of PLINQ (Parallel LINQ). These extension methods can be used quite easily in the LINQ to Excel Provider described in the post. All you need to do is add the AsParallel method to the end of the LINQ query.



ExcelProvider provider = ExcelProvider.Create(@"c:\deploy\Book1.xls");
foreach (Person per in (from p in provider.GetSheet<Person>() where p.LastName == "Johnson" select p).AsParallel())
{
per.LastName = "Smith";
}
Person p = new Person();
p.Id = 10.0;
p.FirstName = "Alex";
p.LastName = "Zander";
p.BirthDate = new DateTime(1980, 4, 4);
provider.GetSheet<Person>() InsertOnSubmit(p);
provider.SubmitChanges();
Console.WriteLine("Done");

4 comments:

prahlad said...

Data Entry Outsourcing Projects Available at www.visionjobcare.com

visionjobcare.comoffers different types of outsourcing projects. Online data entry is one of the best home job for housewives, unemployed, students and part time job finders. Easy Job, just spend 2hrs. daily, & make massive monthly income. We pay you $5 per Assignment. Each Assignment of 5 lines.
For more details E-mail us at support.visionjob@gmail.com
Visit Us at http://www.visionjobcare.com


Website - http://www.visionjobcare.com

Prahlad said...

Data Entry Outsourcing Projects Available at www.visionjobcare.com

visionjobcare.comoffers different types of outsourcing projects. Online data entry is one of the best home job for housewives, unemployed, students and part time job finders. Easy Job, just spend 2hrs. daily, & make massive monthly income. We pay you $5 per Assignment. Each Assignment of 5 lines.
For more details E-mail us at support.visionjob@gmail.com
Visit Us at http://www.visionjobcare.com

lala said...

Thanks for your post and welcome to check: here
.

lala said...

Thanks for your post and welcome to check: here
.