Database suffix builder
Question,
is doing something like this acceptable?
Though I think is is right I'm still getting some dependency injection problems but im not sure if i should spend time on fixing those or if there is a different way
For example this:
18 Replies
Why tho
What do you mean?
Why do those tables even have suffixes
Because our company said so
Ah, rip
Yup
Well, in any case, it seems fine to me
Same, yet
I guess it's trying to do constructor injection somewhere, where you pass the suffix to a constructor
Seems like what you're doing is adding a prefix to all tables, rather than suffix, right?
Like,
tblplantekstobjectsUsers
, tblplantekstobjectsBlogposts
, etc?i though that was a suffix
but yeah that is the case
https://stackoverflow.com/a/12967044/6042255
prefix_foo_suffix
Seems you should be able to just use a conventionI need need a new context every call with supplied prefix
What is acceptable? Assigning default suffixes to tables?
Why not?
Only thing I don't like here is how you inject a primitive type into DI. You should probably have an actual configuration object
What do you mean exactly?
Well not DI directly, but as a parameter
I would make an actual Configuration object instead
I would also really consider using actual DI to get the context. I assume this is an API? You can just call
AddDBContext
and not use factories because there's no reason to
Then you are forced to have a Configuration object 😎
You mean something like this?
god i keep using suffix
but that should be prefix
Yeah pretty much