I am facing with a huge task at hand, start re-factoring our biggest asp.net web which created from asp classic, then ported to asp.net VS2003 and then later on ported on asp.net VS2005. Where codes are old school, all business logic & data access are all to be found on the .aspx.cs files. The good thing is, it is working A-Ok.
Now my question is, is there any guidelines on how to refactor asp.net code behind?
Such as:
– do I need to create a separate class for the refactor codes or should I use the app_code for the new files for the refactor codes?
– refactor code structure.. etc.
Well you obviously want to create some sort of Data Access Layer, which you can build as a separate project.
So get all your data access [ADO] code out of the code behind files, and reference the data access layer.
Feel free to use App_Code, but don’t over do it. Putting too many classes in App_Code can slow down your build times.
Any General/Utility classes, feel free to put into their own class library project as well.
That should get you started.