Paladin.Tips.&.Tricks.#1

Since I have not prepared a tutorial for Paladin *Guilty Look*, I guessed I will just post some tips and tricks whenever I am free. Hopefully, as time goes on, they can be compiled into something useful. Today, we will be looking at Preserving Code Changes in Paladin.

I will presume that you are using BEWizard, the code-generator that comes with the framework to generate the foundation codes. The immediate problem that you will notice from this tool is that it regenerates all code files everytime you run it. While, this maybe acceptable if we do not make any customizations to the code files, it can be very frustrating if we do.

I'm sure everyone of us will add in our own custom properties, methods and other codes into the Entity classes that were generated. And everytime, there is a change in the framework or our database, we will need to copy-and-paste back our changes.

Therefore, to remedy the problem or to reduce the effort required to restore the custom code, I have came up with this implementation strategy. When you first create your classes using the BEWizard, select Inherited Implementation in the Choose Implementation Method step. If you are not sure on how to get this, check the Standard Classes and Base Classes checkboxes in the Implementation Options.

This will effectively cause BEWizard to generate the framework implementation code in Base classes while leaving you with empty class files for your own implementation. You can then implement all of your custom code in this code file (or class).

Subsequently, when you need to regenerate the foundation code (in the event of database changes or a new framework release), select Base Implementation in the Choose Implementation Method step - achievable by unchecking the Standard Classes checkbox in the Implementation Options. BEWizard will then regenerate the Base classes only and leave your custom code in the inherited classes intact.

I hope this tip is useful to you. If you have any questions, please feel free to post them.

No comments:

Post a Comment

Popular Post