✅ how should I deal with common/similar data types between the backend and front?
so i have two projects, one for my backend and the other for the front. now i have this
ShopItemDTO
in the backend and a very similar ShopItem
class for the front. how
now im still early in the project so the class will probably have stuff added/removed from it and it be tedious to just reflect the changes from both classes. i was thinking i could maybe make the ShopItemDTO
shared between the front and backend? but not sure if that would result in any security concerns? or some other problem that i dont know of 😅7 Replies
i would definitely advocate for at least one more project, yes. the name is up to you, i'm not the biggest fan of what i came up with.
you can then also add another project, or simply add a new namespace to your backend project.
im not the greatest with names either but i was thinking i'd just name it
BuyMe.Common
😅
thanks a lot for your help! that does seem a whole lot more elegant then just ctrl+tab'ing between files lolthe issue here is it's not clear what
ShopItemDTO
is being used for
because if it's a creation model, for example, it shouldn't have an id
if it's a viewing model maybe you don't want to give all the fields or maybe you want to add more fields that could be useful like an image
so it could be useful to have a shared abstract class (or even interface) for some 'core' fields, but most probably there will be fields dedicated to the specific featureUnknown User•2w ago
Message Not Public
Sign In & Join Server To View
oh yeah for sure but im still in the "god please just work" phase of the project. i will put in more thought for this in the future 😅
ah good to know. thanks a lot!
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered