convert of the object (image) to another object (Byte) in three layers(3-tier)

我的未来我决定 提交于 2019-12-24 09:37:28

问题


Conversions can be done in the first layer ( UI ) ?


回答1:


For these kind of operations I personally create a Utils class/namespace under project namespace (myProjectNamespace.Utils). A ststic class with public static members for conversions, formatting, calculations...

Put this class in BLL (Business Logic Layer) most of the time but sometimes you need different Utils for different layers.




回答2:


Assuming an image is an input - inputs usually come into a system through:

  • The frontend interface / UI.
  • A backend interface (service).
  • An API call.

If the input is specific to - say the UI - then that would suggest it was a UI specific thing and should sit there.

The same rule / principle applies for the other input 'channels'.

if the API being called is in the BL then that's where it might sit.

Where Yousefvand is coming from (and which I agree with) is that if more than one component is using it then it's probably be a good candidate for putting in some osrt of reusable library.

So...

Conversions can be done in the first layer ( UI ) ?

Yes if the what you're converting is specific to the UI / UI technology being used; otherwise you could but probably shouldn't - in this case you'd probably be better implementing your converter in a utility.



来源:https://stackoverflow.com/questions/4448646/convert-of-the-object-image-to-another-object-byte-in-three-layers3-tier

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!