What layer does a UserControl's base class belong in?
I have an asp.net usercontrol (ascx) that inherits from an abstract class (that inherits from a UserControl). My Project is in a 3-tier architecture (DAL -> Bll -> UI/开发者_开发百科Views). Currently there are no class files in the UI layer (other than the code-behinds). Which layer should I add this abstract class to?
Thanks so much.
A UserControl is part of your presentation, so should be in your UI/Views layer.
Think of it this way: If I was re-implementing this as a Windows Forms application, which layers would I keep? It'd be the DAL and BLL, therefore nothing specific to asp.net should be in either of those layers and the converse is: anything specific to asp.net should be in the UI/Views layer.
Definitely presentation layer. Ideally you don't want anything UI-dependant (such as the base UserControl class or anything from System.Web.UI) in your business logic.
精彩评论