What is the best way to go about creating a custom framework for asp.net?
We have several enterprise level asp.net ecommerce websites all running from completely seperate code bases. What I'd like to do is standardise the common components (session management/urlrewriting/surge control etc) and integrate them into the .net framework at the highest level possible and in a way that my developers cannot (easily) make changes.
I've considered creating a common assembly and just referencing that in each of the solutions but this still relies on the developer wiring up the httphandlers/modules and implementing the basepage design patter开发者_StackOverflow社区n for each individual page/masterpage.
Any insight here would be very much appreciated.
this still relies on the developer wiring up the httphandlers/modules and implementing the basepage design pattern for each individual page/masterpage.
You do trust your developers, don't you? =) If you can't trust your developers to follow whatever process you outline in your system documentation and can't trust your testers to pick up on any pages/areas of sites that don't work correctly because your processes haven't been followed, then nothing you can do to enforce this "in code" is going to make the slightest bit of difference.
There are various things you can consider to assist your developers in doing the right thing, such as:
- Creating Visual Studio project / file templates that automatically include the correct references / base pages
- Create NuGet packages to add the relevant
web.config
configuration values and assemblies to new projects - Document the system and framework so that developers have a go-to resource to answer questions they have.
- Use a wiki, having documentation that gets out of date, or can only be updated by one person, or means that there can be multiple copies floating around is a sure-fire recipe for pain.
- Get your developers buy-in. The more you involve them in decisions being made about your framework/architecture, the more they'll want to use it and ensure it's used correctly. (No, not democracy but maybe a "benevolent dictatorship" ;)
- Utilise your build server. NAnt/MSBuild is extensible, so write custom tasks that can be used to validate that framework guidelines (such as base pages) have been followed. Fail the build if pages don't inherit from the correct base page, for example. If the installer MSI/ZIP/Package isn't built, it can't get as far as your QA environment, let alone your production systems.
精彩评论