S
shapper
Hello,
I am getting some statistics about my database to display on the web
site. For example:
IQueryable<Article> articles = GetArticles();
ArticlesStat stat = new ArticlesStat {
Count = articles.Count(),
CountPerMonth = Math.Round(articles.Count() / (Double)
(DateTimeHelpers.Count(articles.Min(a => a.Created), DateTime.UtcNow,
DateInterval.Month).GetValueOrDefault(1) == 0 ? 1 :
DateTimeHelpers.Count(articles.Min(a => a.Created), DateTime.UtcNow,
DateInterval.Month).GetValueOrDefault(1)), 1),
PublishedCount = articles.Where(a => a.Published == true).Count(),
PublishedShare = Math.Round(articles.Where(a => a.Published ==
true).Count() / (Double)(articles.Count() == 0 ? 1 : articles.Count())
* 100, 1),
}
I have a few more statistics.
My question is should I just get the statistics I need or if I get all
(4 times more similar properties that what I am posting) will I get a
much delayed execution?
The quote is not so complex. I get, as you can see the articles:
IQueryable<Article> articles = GetArticles();
And then I define an object with some calculation.
Thanks,
Miguel
I am getting some statistics about my database to display on the web
site. For example:
IQueryable<Article> articles = GetArticles();
ArticlesStat stat = new ArticlesStat {
Count = articles.Count(),
CountPerMonth = Math.Round(articles.Count() / (Double)
(DateTimeHelpers.Count(articles.Min(a => a.Created), DateTime.UtcNow,
DateInterval.Month).GetValueOrDefault(1) == 0 ? 1 :
DateTimeHelpers.Count(articles.Min(a => a.Created), DateTime.UtcNow,
DateInterval.Month).GetValueOrDefault(1)), 1),
PublishedCount = articles.Where(a => a.Published == true).Count(),
PublishedShare = Math.Round(articles.Where(a => a.Published ==
true).Count() / (Double)(articles.Count() == 0 ? 1 : articles.Count())
* 100, 1),
}
I have a few more statistics.
My question is should I just get the statistics I need or if I get all
(4 times more similar properties that what I am posting) will I get a
much delayed execution?
The quote is not so complex. I get, as you can see the articles:
IQueryable<Article> articles = GetArticles();
And then I define an object with some calculation.
Thanks,
Miguel