Using NCache 4.6 with EF 6.1.3, can't make it to work with NCache API.
It works when using query policy inside efcaching.ncconf
but using only api-level-caching
and .Cache()
method, have no effect in caching.
Steps that I've taken:
Added Alachisoft.Integrations.EntityFramework.CachingProvider
refrence to project.
Added interceptor:
<interceptors>
<interceptor type="Alachisoft.NCache.Integrations.EntityFramework.Caching.EFCommandInterceptor, Alachisoft.Integrations.EntityFramework.CachingProvider" />
</interceptors>
Added Alachisoft.NCache.Integrations.EntityFramework.Caching
namespace to file.
And finally, using their EntityDataModel
sample, for example, changed PrintCustomerList(customerQuery);
to PrintCustomerList(customerQuery.Cache());
, but result is not cached.
UPDATE 1:
Checking with dumpcachekeys.exe
, it has actually created cache for my queries, but still it goes to database for results.
UPDATE 2:
Trying to dump cash data with dumpcachedata.exe
fails with following error:
Items in cache : 3
Error: Failed to resolve assembly: EntityFrameworkDynamicProxies-EntityDataModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
System.Exception: Failed to resolve assembly: EntityFrameworkDynamicProxies-EntityDataModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
at Alachisoft.NCache.Tools.DumpCacheData.DumpCacheData.MakeBackup(Cache cache, String path)
at Alachisoft.NCache.Tools.DumpCacheData.DumpCacheData.Run(String[] args)
UPDATE 3
Disabling dynamic proxy in entity framework for EntityDataModel
sample, solved error thrown in dumpcachedata.exe
, and now cash data successfully dumps. But still cached queries cause database trip.