This project is read-only.
1
Vote

CacheableRepository hits DB twice

description

I was testing CacheableRepository when in Profiler I can see database of code below being queried twice.

using (var con = new EntityDataContainer())
        {
            IRepository<Role> db = new Repository<Role>(new DbContextAdapter(con));
            IRepository<Role> ca = new CacheableRepository<Role>(db);

            var roles1 = ca.Find(r => r.name.StartsWith("A"));    //1st DB hit at  _cacheProvider.Add(query, policy);

            foreach (var r in roles1)    //2nd DB hit
            {
                //Do something
            }

comments