2

I am creating a 3 tier architecture web application, and I want to use extension methods. In which layer should I place the extension methods?

Thanks.

Adi Lester
  • 24,731
  • 12
  • 95
  • 110
Becks
  • 75
  • 1
  • 7
  • Depends on what the static methods do - if you add a bunch of MVC Html helpers, then presentation tier makes sense. And methods working on SqlAdapter / DataReader would be data tier etc. If these methods are reusable in other projects, you would probably want to separate them into utility assemblies. – StuartLC Sep 11 '12 at 11:37

1 Answers1

4

You place extension methods at any layer that uses them.

Extension methods can be extending base UI classes, BLL classes and/or DAL classes.

You place them near where they are used - if they are to be used in several places, you place them in a utility or core class/assembly.

Oded
  • 489,969
  • 99
  • 883
  • 1,009