how to configure second level cache in code (not thru xml)
the current settings i have are:
public NHCachingSetup(Configuration cfg)
{
// use first level cache
cfg.Cache(x =>
{
x.UseQueryCache = true;
x.Provider<SysCacheProvider>();
});
// set 60 min expiration time
cfg.SessionFactory().Caching
.WithDefaultExpiration(60);
}
The way I have done this with NH 3.3 is like
edit in your mapping you will need:-
end edit
Then to use you can do something like (this caches a lookup table for me):-