Recently, I have been thinking about the management of Web software upgrades. I have previously written them separately and updated them one by one. But later I found that the upgrade of the exaggerated version is troublesome. With the upgrade of the version,CodeMore and more code can't be reused, And I never think of a simple code method.
Using system; using system. web; namespace caicai. jingpin. UI. update {public class u_1_2: system. web. UI. page {protected void page_load (Object sender, eventargs e) {string action = request. querystring ["action"]; If (Action = "Update") {This. update () ;}} public void Update () {// Update fileProgramHttpcontext. Current. response. Write ("V1.0 upgraded to V2.0 successful! "); Httpcontext. Current. response. Write (" <br/> ");}}}
using system; using system. web; namespace caicai. jingpin. UI. update {public class u_2_3: system. web. UI. page {protected void page_load (Object sender, eventargs e) {string action = request. querystring ["action"]; string version = request. querystring ["version"]; If (version = "1") {New u_1_2 (). update ();} If (Action = "Update") {This. update () ;}} public void Update () {// Update file program httpcontext. Current. response. Write ("V2.0 upgraded to V3.0 successfully! "); Httpcontext. Current. response. Write ("
") ;}}
using system; using system. web; namespace caicai. jingpin. UI. update {public class u_3_4: system. web. UI. page {protected void page_load (Object sender, eventargs e) {string action = request. querystring ["action"]; string version = request. querystring ["version"]; If (version = "1") {New u_1_2 (). update (); New u_2_3 (). update ();} If (version = "2") {New u_2_3 (). Update ();} If (Action = "Update") {This. update () ;}} public void Update () {// upgrade the file program httpcontext. current. response. write ("V3.0 is successfully upgraded to v4.0! "); Httpcontext. Current. response. Write ("
") ;}}
Using system; using system. web; namespace caicai. jingpin. UI. update {public class u_4_5: system. web. UI. page {protected void page_load (Object sender, eventargs e) {string action = request. querystring ["action"]; string version = request. querystring ["version"]; If (version = "1") {New u_1_2 (). update (); New u_2_3 (). update (); New u_3_4 (). update ();} If (version = "2") {New u_2_3 (). update (); New u_3 _ 4 (). update () ;}if (version = "3") {New u_3_4 (). update ();} If (Action = "Update") {This. update () ;}} public void Update () {// upgrade the file program httpcontext. current. response. write ("v4.0 is successfully upgraded to V5.0! "); Httpcontext. Current. response. Write (" <br/> ");}}}