Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linq issue

Status
Not open for further replies.

princesszea

Technical User
Aug 11, 2008
33
GB
Hi,

Using the code below can someone please show me how to cache my query below.
Code:
  var query = from row in dt.AsEnumerable()
                        group row by row["name"] into grp

                        let totalcount = dt.AsEnumerable().Count()

                        select new
                        {
                            Id = grp.Key,
                            Count = grp.Count(),
                            TotalCount = totalcount,
                            Ratio = grp.Count() / totalcount

                        }
                  

            foreach (var grp in query)
            {
                int Count = grp.Count;
                int TotalCount = grp.TotalCount;
                int value = Count * 100 / TotalCount;

            }
Thanks
 
you wouldn't cache the linq object/statement, you would cache the results. How you cache can be done any number of ways. I would recommend a caching library, rather than rolling your own. here are some:
asp.net syscache and syscache2
memcached
bamboo prevalence
velocity


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top