views:

44

answers:

3

I have a method which I have to use in two aspx pages. This method calls method in Data Access Layer. This method is 35 lines long. This method is not using any UI element.

Structure of my project is like this.

Solution MyProject
 - BaseWeb
 - CommonLib
 - DataAccessLayer

My Data Access Layer is generated from LLBLGen Pro (an O/R mapper) and this layer is also behaving as Business layer.

Question is, should I create this method in botn aspx files or move this method in CommonLib and just call it in aspx pages?

Thanks.

A: 

The latter. Code duplication is a bad code smell.

tomfanning
A: 

Either have it as a control or move it into CommonLib depending if it uses UI elements or not.

DeletedAccount
A: 

DRY - Don't Repeat Yourself. A common method should be refactored into a class that is available to both pages.

tvanfosson