Why Neo? Because it is simple and object-oriented:
The following code snipped shows how to load all titles (i.e. books) that were published before a certain date, apply a clearance discount and then save the changes to the database:
IDataStore datastore = new SqlDataStore(" database connection string ");
ObjectContext context = new ObjectContext(datastore);
TitleFactory factory = new TitleFactory(context);
TitleList matchingTitles = factory.Find("PublicationDate < {0}", new DateTime(2003, 1, 1));
foreach(Title title in matchingTitles) {
title.ApplyClearanceDiscount();
}
context.SaveChanges();
Where ApplyClearanceDiscount() could look like:
public void ApplyClearanceDiscount()
{
this.Price = this.Price * (1 - GetClearanceDiscount());
}
… from 5 Reasons