服务器控制/数据访问最佳实践?
是从 Web 父应用程序内部访问数据并通过属性将必要的数据传递给控件并返回,还是传递(Web 服务的)引用或 url 指针来控制并让它访问其包含的字段的数据,这是否更好?请记住,父级不需要在服务器控件使用的其他任何地方使用数据。
Is it better to access data from within the web parent app and pass the necessary data to the control and back via properties, or pass a reference or url pointer (of webservice) to control and let it access the data for the fields it encompasses keeping in mind that the parent doesn't need to use the data anywhere else that the server control uses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个想法是您不希望 UI 与数据库层交互。因此,您可以通过创建数据层(基本上是一个可以编译为程序集/dll 的类)来抽象该数据。您的 UI 与 BLL 通信,而 BLL 又与 DAL 通信。
The idea is you don't want the UI interacting with the db layer. So you abstract that data by creating a datalayer (basically a class which you can compile down to an assembly / dll). Your UI talks to the BLL which in turn talks to the DAL.
我认为通常通过应用程序管理控件会更容易,但在某些情况下,特别是当您不需要应用程序访问数据时,您可以嵌入控件,例如当您想嵌入外部视频播放器时等或一些外部网络部件或其他框架。
I think that usually it would be easier to manage the control by the app, but in some scenarios especially when you don't need the application to access the data you can just embed the control, e.g. when you want to embed an external video player etc. or some external web-part or other frame.