Skip to main content

One post tagged with "linq"

View All Tags

Analytical Queries using Entity Framework over Date Ranges using Linq

Greg Roberts

Greg Roberts

Greg Roberts

The other day I decided to start doing some analytics style queries purely in Linq against my existing normalized structure. Normally these types of queries are best suited on a Star Schema, but I think for what I wanted it was simple enough to do in the transactional tables, plus most sites don’t have a true “data warehouse” anyways.

First lets go over what I was looking to do.

For a given date range, get the total number of logins per day. Use only Linq in my EF model ( no stored procedures). Most processing should happen in the DB I know what you are thinking, that is super simple. I agree it is, but there are some hidden complexities that I think are worth sharing.