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
Customizing App_Code classes: how prevent upgrade overwrite?
Re: Customizing App_Code classes: how prevent upgrade overwrite?
I think source control is the best technique to track future upgrades. Read following thread as well
viewtopic.php?f=47&t=10082
viewtopic.php?f=47&t=10082
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Customizing App_Code classes: how prevent upgrade overwrite?
A couple of us still can't get the hang of Subversion, hope you get it better!
One one of our sites, I needed for the ProductHelper class to be modified for option presentation so that customers could purchase multiple products with options from one page and one add to cart button. I took the code out of the ProductHelper class and made a new class, then used that on the page code. That way I preserved the ProductHelper class as it was originally. On a couple of other projects, I have made a new data access layer for custom objects, but also on one of them I put a new class in the website for a couple of pieces of code that might need editing, so I didn't want to bury them in the dll, but I did need to use the code on several pages.
One one of our sites, I needed for the ProductHelper class to be modified for option presentation so that customers could purchase multiple products with options from one page and one add to cart button. I took the code out of the ProductHelper class and made a new class, then used that on the page code. That way I preserved the ProductHelper class as it was originally. On a couple of other projects, I have made a new data access layer for custom objects, but also on one of them I put a new class in the website for a couple of pieces of code that might need editing, so I didn't want to bury them in the dll, but I did need to use the code on several pages.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Customizing App_Code classes: how prevent upgrade overwrite?
Coming from someone with a highly modified site, I think that no matter what, you're going to have to do some work when rolling out an upgrade. To make the process (virtually) painless, I would...
1) Comment all sections of code that you have modified, so the mod's can be easily searched for.
2) Use a tool like Beyond Compare to merge changes to upgraded / modified files.
3) Keep a list of modifications you have made.
I didn't do any of these things until I actually started thinking about implementing the upgrade.
Wish I would have....
Scott
1) Comment all sections of code that you have modified, so the mod's can be easily searched for.
2) Use a tool like Beyond Compare to merge changes to upgraded / modified files.
3) Keep a list of modifications you have made.
I didn't do any of these things until I actually started thinking about implementing the upgrade.
Wish I would have....
Scott