Skip to content

Instantly share code, notes, and snippets.

@afifmohammed
Created April 22, 2012 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afifmohammed/2448267 to your computer and use it in GitHub Desktop.
Save afifmohammed/2448267 to your computer and use it in GitHub Desktop.
new querite api
public class FileSystem
{
public void Evaluate(IFolder folder)
{
int? count;
TimeSpan? howLong;
var firstTen = Query(folder)
.Statistics(x => count = x.Count)
.Statistics(x => howLong = x.ExecutionSpan)
.Customize(x => x.AsOf(15.MinutesFromNow()))
.Customize(x => x.CachedFor(10.Minutes()))
.Execute(new LongNameFiles { Skip = 0, Take = 10, Length = 15 });
}
/// <remarks>should use ioc, method only shown to demonstrate the point</remarks>
private IQuery<TSource> Query<TSource>(TSource source)
{
return new CacheableQuery<TSource>(
actualQuery: new Query<TSource>(source),
cacheStoreFactory: new InMemoryCacheFactory());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment