Archive for April, 2011
I had very little trust on download sites. Mainly because they just pull in product information from PAD files without adding any special value for the downloaders & the vendors. Download.com is the #1 amongst download sites but they can do lot better.
To our surprise FindMySoft.com is different. It writes exclusive reviews about a software product.
I had a list of tags for a particular user. I wanted to show only unique tags. I initially thought there would be something an inbuilt ‘distinct’ operator in Linq. Unfortunately not. I then discovered the Distinct() function. But it doesn’t support filtering the results by a particular column.
Thanks to this StackOverflow question that set my direction. It says that I must use the ‘group by’ operator, which I did.
Following is the code that I ended up with:
1 2 3 4 5
//distinct tags for a particular user var tags = from t in _db.Tags where t.UserId == userId group t by t.Name into g select g.FirstOrDefault();
Since the query returns a group, we must select the first item in the group. Hence FirstOrDefault().
Last week Godaddy’s CEO was in news for his controversial act of Killing an elephant.
Now, I am not in favor of killing (obviously). But how is this different from killing of millions of chickens, goats, pigs, turtle, fishes, lobsters etc for eating, clothing etc.
Somebody please explain? What am I missing?
I was happily working with Entity Framework 1 until I read at several places about its lack of important features that are normally expected from an ORM framework. I started thinking seriously about upgrading to Entity Framework 4 (yes, the next version after Entity Framework 1) after I read this No Confidence letter. It lists all the issues that EF1 has and also suggests improvements. Several architects signed it.
So I upgraded to Entity Framework 4. This required me to upgrade my projects to Visual Studio 2010 & .Net Framework 4. Along with this, I also upgrade my MVC 2 project to MVC 3 with the help of this article.
Although POCO & Persistence Ignorance are the two most-liked features, they did not interest me because I had already generated the Entity classes from the database in EF1 and mapped them to my own model. What interested me was Lazy Loading and Foreign key association.
Entity Framework 4 addresses several issues and it has undergone a major rework. Worth upgrading.