views:

29

answers:

2

I have repositories like this in my application

public class FooRepo
{
    public Foo Get(int id)
    {
       return Foo from Db;
    }
}

I'm just wondering if there is possible to do some caching for the methods inside the repository, or probably there is no need because sql-server does it for me, but if needed could someone point/show me some solutions

thnx

+1  A: 

Depends. Caching IN The repository is a LOT faster than asking the database. For many data items it makes a lot of sense.

TomTom
A: 

LINQ queries can be cached using SqlDependency active caching. SqlDependency relies on Query Notifications to get invalidation notifications from the server when the data has changed.

Remus Rusanu