Open JetForMe opened 2 years ago
@JetForMe It's only Application.Repositories
that is instantiated, that type is just a helper type for accessing the actual factory methods for repositories. The actual factory methods/closures are stored in app.storage
with the Application.Repositories.Storage
type, so they are persistent across the entire Application
That's not what I see when I put a breakpoint there. It gets called multiple times.
There's a bit of code I don't understand, on https://github.com/madsodgaard/vapor-auth-template/blob/fc3f4a7d8a6c3f74305c38718f0798728d46fda1/Sources/App/Services/Repositories.swift#L60
This results in
Repositories
being instantiated on every access.