DbContextOptionsBuilder<TContext>.UseMemoryCache(IMemoryCache) Yöntem

Tanım

Bu IMemoryCache bağlama göre sorgu önbelleğe alma için kullanılacak olan 'i ayarlar.

Bellek önbelleğinin değiştirilmesinin EF'nin yeni bir iç hizmet sağlayıcısı oluşturması ve bu da performans sorunlarına neden olabilir. Genellikle, verilen bir uygulama için en fazla bir veya iki farklı örnek kullanılmaz.

Bu yöntem, uygulama bir çağrısı aracılığıyla iç hizmet sağlayıcısını ayar kuruyorsa UseInternalServiceProvider(IServiceProvider) kullanılamaz. Bu durumda, IMemoryCache doğrudan bu hizmet sağlayıcısında yapılandırılması gerekir.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseMemoryCache (Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache);
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseMemoryCache (Microsoft.Extensions.Caching.Memory.IMemoryCache? memoryCache);
override this.UseMemoryCache : Microsoft.Extensions.Caching.Memory.IMemoryCache -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)>
Public Overridable Function UseMemoryCache (memoryCache As IMemoryCache) As DbContextOptionsBuilder(Of TContext)

Parametreler

memoryCache
IMemoryCache

Kullanılacak bellek önbelleği.

Döndürülenler

DbContextOptionsBuilder<TContext>

Birden çok çağrının zincirlene kadar aynı oluşturucu örneği.

Şunlara uygulanır