So when refactoring things I noticed the pattern to throw certain dependencies, such as the database, etc. into the context. This is kinda a code smell, mainly because we lose alot of compiler-enforced type safety, as we have to do typecasting in order to pull things out of the context.
Dependencies, such as the database model, should be wired through via struct constructors; this allows type-safe usage of said dependencies without having to assume that they exist in the context.
So when refactoring things I noticed the pattern to throw certain dependencies, such as the database, etc. into the context. This is kinda a code smell, mainly because we lose alot of compiler-enforced type safety, as we have to do typecasting in order to pull things out of the context.
Dependencies, such as the database model, should be wired through via struct constructors; this allows type-safe usage of said dependencies without having to assume that they exist in the context.