Last post Dec 18, 2009 08:32 AM by integrasol
Dec 18, 2009 06:18 AM|eddy556|LINK
I have created a custom control which directly accesses the database through our database access layer. It basically accepts two arguments in a method, and using these receives data from the database for display, all through the db access layer.
A team member has told me that in order to make it fully reusable I should be separately accessing the database from within my page logic, and then just passing the data to the control, for it to show. However as the control will only be used within this
context, I fail to see any problems, and I suppose if their are problems, that particular method doesn't need to be called?
So what the best practice in this case?
Dec 18, 2009 08:32 AM|integrasol|LINK
It depends... If you go with your current solution, the custom control is loosely coupled with the page, but tightly coupled/tied to the DAL. Seeing as the control will never stand on it's own, I would go with your team member's suggestion of feeding the
data from the page, as it will make it easier to reuse. I know you state that it will not be used elsewhere, but can you really be sure of that, and if so, why create a custom control, if the functionality is really tied to the page? I'm just throwing in more
things to consider, and what I would do.