Closed mpp closed 2 years ago
Perhaps it would be best to add some sort of an Attribute
with a ServiceLifetime
parameter so anyone could control how effects are registered.
I personally would have expected effects to be registered as Transient
.
I personally would have expected effects to be registered as Transient.
I agree with you as I'd expect a new Effect<>
instance for every dispatch of the trigger action
Effect types are discovered at app start up and registered as scoped, the same as a store.
When a store is created via dependency injection it will create and instance of each effect type and add them to a list within the store.
HttpClients should be reused, not disposed. If you do that, your app will quickly exhaust all available connections.
Connected discussion: #261
Connected discussion: #261
Hi @peterbozso sorry for not noticing your issue, it is exactly the same as what I posted. We might close this issue and continue the discussion in the "original one"
@mrpmorris As @peterbozso I see actions conceptually the same as HTTP Requests and Effects as Controllers. I also acknowledge the problem you mentioned by disposing the HttpClient. I'll reach the nuget library owner and ask for a fix.
Hi! I have a question regarding the Effect classes. I see that you registered them as scoped here but I see that the constructor is called only once instead than at every dispatch of the trigger action.
For example I have two HttpClient that come from two different Nuget that I register as scoped services. One of the two has a Dispose method that is called after every "use".
Due to this difference I found my self needing to handle them in a different way. This for the client that do not "dispose itself":
This for the client that do "dispose itself":
Is this the expected behavior? Am I missing/mixing something on how scoped services works?