EntityFrameworkCore.NCache 5.3.7

dotnet add package EntityFrameworkCore.NCache --version 5.3.7
                    
NuGet\Install-Package EntityFrameworkCore.NCache -Version 5.3.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntityFrameworkCore.NCache" Version="5.3.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EntityFrameworkCore.NCache" Version="5.3.7" />
                    
Directory.Packages.props
<PackageReference Include="EntityFrameworkCore.NCache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EntityFrameworkCore.NCache --version 5.3.7
                    
#r "nuget: EntityFrameworkCore.NCache, 5.3.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EntityFrameworkCore.NCache@5.3.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EntityFrameworkCore.NCache&version=5.3.7
                    
Install as a Cake Addin
#tool nuget:?package=EntityFrameworkCore.NCache&version=5.3.7
                    
Install as a Cake Tool

NCache Entity Framework Core

NCache Entity Framework Core integration extends Entity Framework Core with distributed query caching capabilities, allowing applications to cache query results in NCache using LINQ extension methods. It supports both transactional data and reference data caching while reducing database load and improving application performance.

The package provides synchronous and asynchronous extension methods that integrate directly with IQueryable, enabling applications to cache query results without modifying existing LINQ queries.

Key benefits:

  • Distributed query caching for Entity Framework Core
  • Synchronous and asynchronous query caching APIs
  • Supports both transactional and reference data caching
  • Flexible caching strategies for storing query results
  • Reduces repetitive database queries and improves application scalability

Installation

Install-Package EntityFrameworkCore.NCache

or, using the .NET CLI:

dotnet add package EntityFrameworkCore.NCache

What is Installed

Installing this package adds the following NCache configuration files to your project:

  • client.ncconf � Defines the cache client settings, including the cache name and the list of server nodes the client connects to.
  • config.ncconf � Contains the cache configuration (cache topology, partitions, eviction policy, etc.) used when the cache is created or registered.
  • tls.ncconf � Contains TLS/SSL settings used to secure communication between the client and the NCache cluster, if enabled.

Prerequisites

Before using this package, ensure you have:

  1. A running NCache Server cluster.
  2. An NCache cache created and running on the cluster.
  3. The EntityFrameworkCore.NCache package installed.
  4. Include the following namespaces in your application:
    • Alachisoft.NCache.EntityFrameworkCore
    • Alachisoft.NCache.Runtime.Caching
  5. Ensure the entities being cached are serializable.

Getting Started

Setting up NCache

If NCache is not installed on the machine running your application, update the configuration files included with this package so the client can connect to your cache.

  1. Open client.ncconf.
  2. Locate the cache entry named myCache and replace it with the name of your cache.
  3. Update the server address to point to a node hosting that cache.

Example:

<cache id="myCache" ... >
  <server name="10.0.0.1" ... />
</cache>

Replace:

  • myCache with the name of your cache.
  • 10.0.0.1 with the hostname or IP address of an NCache server node.

Configuration

Caching behavior is configured through the CachingOptions class, which controls how query results are stored in NCache.

Property Description
QueryIdentifier Specifies a custom identifier for the cached query. If omitted, NCache automatically generates one based on the LINQ query.
StoreAs.Collection Stores the complete query result as a single cache entry.
StoreAs.SeparateEntities Stores each entity individually using separate cache keys, enabling fine-grained cache updates.
bulkInsertChunkSize When using StoreAs.SeparateEntities, controls the number of entities inserted per bulk operation. Defaults to 1000.
errorEnabled When true, cache-related failures are propagated as exceptions. Defaults to false.

Query Caching APIs

NCache provides the following Entity Framework Core extension methods.

Synchronous Asynchronous
FromCache FromCacheAsync

FromCache and FromCacheAsync provide identical caching behavior. Use FromCacheAsync for asynchronous query execution.

FromCache

FromCache configures an Entity Framework Core query to use NCache. When the query is executed for the first time, the results are retrieved from the database and stored in the cache. Subsequent executions of the same query retrieve the results directly from NCache, reducing database round-trips.

This API is recommended for transactional data, where database updates occur frequently but repeated reads can benefit from caching.

Query Caching

NCache supports two strategies for storing Entity Framework Core query results:

  • Collection � stores the complete query result as a single cache entry. This strategy is recommended for read-heavy scenarios where the entire result set is typically accessed together.
  • SeparateEntities � stores each entity individually, allowing finer-grained cache updates and lookups.

For large datasets using StoreAs.SeparateEntities, bulk insertion can be optimized by configuring bulkInsertChunkSize, allowing entities to be cached in manageable chunks while avoiding connection timeouts.

References

Reference documentation is available at:

https://www.alachisoft.com/resources/docs/ncache/prog-guide/entity-framework-core-caching.html

Resources

Technical Support

Alachisoft© provides various sources of technical support.

Copyright � 2026 Alachisoft.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EntityFrameworkCore.NCache:

Package Downloads
SahfieiSampleTest

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.3.7 47 8/6/2026
5.3.6.1 902 10/10/2025
5.3.6 521 8/12/2025
5.3.5 651 5/30/2025
5.3.4 3,465 6/6/2024
5.3.3 3,523 2/1/2024
5.3.2.1 2,815 10/12/2023
5.3.2 2,163 9/27/2023
5.3.1 3,438 8/4/2023
5.3.0 19,250 4/12/2022
5.2.1 4,339 10/12/2021
5.2.0 8,630 3/25/2021
5.1.0 5,977 11/23/2020
5.0.4.1 5,090 11/4/2020
5.0.4 4,668 10/28/2020
5.0.3 27,884 6/15/2020
5.0.2 41,488 1/6/2020