Customizing App_Code classes: how prevent upgrade overwrite?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Customizing App_Code classes: how prevent upgrade overwrite?

Post by ZLA » 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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Customizing App_Code classes: how prevent upgrade overwrite?

Post by mazhar » Wed May 20, 2009 1:10 am

I think source control is the best technique to track future upgrades. Read following thread as well
viewtopic.php?f=47&t=10082

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Customizing App_Code classes: how prevent upgrade overwrite?

Post by ZLA » Wed May 20, 2009 6:07 am

Thanks Mazhar.

User avatar
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?

Post by jmestep » Wed May 20, 2009 6:27 am

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.
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

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Customizing App_Code classes: how prevent upgrade overwrite?

Post by heinscott » Wed May 20, 2009 7:15 am

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

Post Reply