Skip to content

Implementing FusionCache with EF Core 5 #21

@tomaz-moharic

Description

@tomaz-moharic

Hi! First, thank you for making such a great library! I am trying to implement FusionCache into an API running on EF Core 5, Mysql and Redis. The issue is that when the FactorySoftTimeout is triggered and the factory is supposed to continue in the background and update the cache when finished, we are instead presented by an System.ObjectDisposedException error:

image

It looks like the DbContext gets disposed before the factory running in the background is finished working with it. How can I keep the DbContext open for the factory to finish its task?

This is my EF Core database configuration:

image

This is the FusionCache configuration:

image

And this is how FusionCache is used inside a Controller:

image

In the Service, DbContext object is accessed via a dependency injection.

If you need any additional information or code snippets I will be happy to provide.

I would be very thankful for any help or advice you can offer.

Kind regards,
Tomaž

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions