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

Couple thoughts #2

Open
msmolka opened this issue Feb 10, 2018 · 0 comments
Open

Couple thoughts #2

msmolka opened this issue Feb 10, 2018 · 0 comments

Comments

@msmolka
Copy link

msmolka commented Feb 10, 2018

I understand the need of EF factory, but is it really neccessary in Core version?
Isn’t simpler to use built in scope factory and default EF core scope lifetime.
So every time the shorter than request (or longer) is required use:

using(var scope = scopeFactory.CreateScope())
{
   var context = scope.ServiceProvider.GetRequiredService<DbContext>();
}

This should result with exactly the same purpose, but will allow greater flexibility with sharing context between different repositories for transactions.

Another thing is related about finalizer inside subscription code. You should never use it unless there are unmanaged resources. Here is great article about this:
https://ericlippert.com/2015/05/18/when-everything-you-know-is-wrong-part-one/

Third one: why scoped IHubContext. Why scoped. As far as I know it is by default singleton. So why to change it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant