Customizing App_Code classes: how prevent upgrade overwrite?
Posted: Tue May 19, 2009 9:53 pm
I need to modify ProductHelper.cs for some customer field validation. I found the post on required fields validation so I know how to make the changes in the file itself. But I want to prepare as much as possible in the event of an upgrade. I read the reference post on ways to keep the customizations separate but it mostly talked about keeping copies of the conlibs and scriptlets in the custom folders, which I've done.
I'm wondering if there is an accepted practice for how to structure my customization of ProductHelper.cs. I'm not strong yet on C# (I can write logic without a problem but I'm weak on namespaces, subclassing and such). One idea I had would be to put the custom code in a separate file and replace the guts of the current methods I'm replacing with a call to my new methods. That way, my code would remain after an upgrade and I would just have to do a quick replacement in the event of an upgrade.
I'm also using source control so I will always be able to do a difference to locate any changes in the future, but I still want to know ways to minimize upgrade pain. Please let me know your thoughts. Thanks. -- ZLA
I'm wondering if there is an accepted practice for how to structure my customization of ProductHelper.cs. I'm not strong yet on C# (I can write logic without a problem but I'm weak on namespaces, subclassing and such). One idea I had would be to put the custom code in a separate file and replace the guts of the current methods I'm replacing with a call to my new methods. That way, my code would remain after an upgrade and I would just have to do a quick replacement in the event of an upgrade.
I'm also using source control so I will always be able to do a difference to locate any changes in the future, but I still want to know ways to minimize upgrade pain. Please let me know your thoughts. Thanks. -- ZLA