[英]What are the pros and cons of having a repeater control in a 3-tier application?
In terms of data accessing, or any other opinions. 在数据访问方面,或任何其他意见上。
If possible, state a better alternative if any. 如果可能的话,请陈述一个更好的选择。
The repeater control doesn't have any bearing on whether you have a good or bad 3-tier application. 中继器控件与3层应用程序的好坏无关。 It's simply a pre-built ASP.NET control that you can use to iterate over data.
它只是一个预构建的ASP.NET控件,可用于遍历数据。 That data can be anything from a datatable to strongly typed class from your model-tier.
这些数据可以是任何数据,从数据表到模型层中的强类型类。
We usually stray away from using repeaters unless we are doing something that requires event handling. 除非我们做需要事件处理的事情,否则我们通常会避免使用中继器。
Server controls in general have a lot of overhead because they're meant to abstract the web (they also have their own life-cycle) and provide hooks for binding and event handling. 服务器控件通常会有很多开销,因为它们旨在抽象化Web(它们也具有自己的生命周期)并为绑定和事件处理提供挂钩。 If you don't need to do any event handling, then I would recommend just using a simple loop.
如果您不需要执行任何事件处理,那么我建议您仅使用一个简单的循环。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.