DbContextOptionsBuilder.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 UseMemoryCache (Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache);
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseMemoryCache (Microsoft.Extensions.Caching.Memory.IMemoryCache? memoryCache);
abstract member UseMemoryCache : Microsoft.Extensions.Caching.Memory.IMemoryCache -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.UseMemoryCache : Microsoft.Extensions.Caching.Memory.IMemoryCache -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function UseMemoryCache (memoryCache As IMemoryCache) As DbContextOptionsBuilder

Parametreler

memoryCache
IMemoryCache

Kullanılacak bellek önbelleği.

Döndürülenler

DbContextOptionsBuilder

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

Şunlara uygulanır