Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbContextActivator missing in net core 3? #22327

Closed
ronsson opened this issue Aug 31, 2020 · 4 comments
Closed

DbContextActivator missing in net core 3? #22327

ronsson opened this issue Aug 31, 2020 · 4 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@ronsson
Copy link

ronsson commented Aug 31, 2020

Hello,

I can't find the DbContextActivator class after upgrading to net core 3.1. I was using it and was wondering if it has been removed?

@bricelam
Copy link
Contributor

We made it a little harder to reference the EFCore.Design assembly where it lives. See Microsoft.EntityFrameworkCore.Design is now a DevelopmentDependency package.

Out of curiosity, how what are you using it for?

@ronsson
Copy link
Author

ronsson commented Sep 1, 2020

Thanks for the explanation. Well, I am breaking the DI pattern and recreate DB Contexts at certain intervals or after x transactions instead, performing operations in a BackgroundService per database. I still believe that must be a lot better where I have hundreds or thousands of operations per second also it is only created in that class.

This is a game server running in IIS so I get a lot of database input via web socket communication.

I don't use Controllers for realtime data management that much and can't DI all my various classes since the classes remain alive until the application dies. I tried retrieving the context from services but it becomes disposed.

But yeah if you have a silver bullet for DI with persistent classes or retrieving contexts from IWebHost.Services and I am totally wrong about my assumption I'd be happy to learn :D

public class DbThreadUpdater<T, C> : BackgroundService where C : DbContext

@AndriySvyryd
Copy link
Member

@ronsson Check out DbContextFactory added in #21246 and available in 5.0.0-preview7

@ronsson
Copy link
Author

ronsson commented Sep 2, 2020

Thanks!

@ronsson ronsson closed this as completed Sep 2, 2020
@ajcvickers ajcvickers added closed-no-further-action The issue is closed and no further action is planned. customer-reported labels Sep 2, 2020
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

4 participants