Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Customizing code

$
0
0
Re: Customizing code
Web Connection 5.0
Re: Customizing code
03/16/2012
01:26:27 PM
3GG0ST7U2 Show this entire thread in new window
Gratar Image based on email address
From:
To:
Attachments:
None
Luca,

Are you declaring your actual process class with:

DEFINE CLASS MyApplicationProcess as MyProcess

There's no real need to change the WWC_PROCESS override because that class is only explicitly declared once in your application.

+++ Rick ---


Dear Rick,
I made MyProcess class
DEFINE CLASS myProcess AS wwProcess

where I set
cAuthenticationMode = "Custom"

and I modified OnAuthenticateUser function.

I put in MyAppMain.OnLoad

SET PROCEDURE TO myProcess.prg ADDITIVE

and I added to wconnect_override.h

#UNDEFINE WWC_WWPROCESS #DEFINE WWC_WWPROCESS myProcess

However when I try Process.Authenticate() with Debug I see

cAuthenticationMode = "Basic"

and the OnAuthenticateUser executed is the original one, not the modified one in MyProcess class.
If I try MyProcess.Authenticate() I get the error "Object MyProcess is not found".
Please, why application does not instantiate MyProcess class in place of wwProcess? I defined MyProcess in WWC_WWPROCESS.
Is the Process object related to wwProcess class or to MyProcess class?
Thank you very much again

You need to inherit your classes from your own subclass, not wwBusiness after you've created the classes using the Wizard. if you manually create them create them inheriting from your class.

Web Connection is designed to run from the Web Connection folder by default so it can find everything. If you move files you will need to reconfigure the Web Connection installation manually. There are a few paths in the config files that point to the source location. If you move files out of the running folders make sure your code or your environment is set up to include your wconnect classes and root folder when compiling.

+++ Rick ---



Dear Rick,
excuse me but I have problems to configure.

1)
I moved project from c:\wconnect to c:\myapp
I changed GeneratedSourceFile property in web pages about new folder
I customized wwProcess and wwBusiness classes as mywwProgress.prg and mywwBusiness.prg
I modified wconnect_override.h file:

#UNDEFINE WWC_WWBUSINESS #DEFINE WWC_WWBUSINESS mywwBusiness #UNDEFINE WWC_WWPROCESS #DEFINE WWC_WWPROCESS mywwProcess <</div>>

I modified Main.prg (OnLoad):

SET PROCEDURE TO Source\mybusiness.prg ADDITIVE SET PROCEDURE TO Source\myprocess.prg ADDITIVE <</div>>

However compilation bring ever into project the original wwBusiness and wwProcess classes and I have error because the application runs the original wwBusiness class, instead of mywwBusiness one.
Please what is wrong?

2)
Do I have to move also wconnect.h and wconnect_override.h files when I move a project from wconnect folder?
And if I cannot move wconnect.h and wconnect_override.h files from wconnect folder, how to live together two o more different projects with different wconnect_override.h files in wconnect folder?

Thank you very much again


Just sublcass wwBusiness and then use that as your base class for whatever business objects you create. Don't change wwBusiness.

+++ Rick ---



Dear Rick,
I would like, for example, to change Opend method of wwBusiness class, so what I have to do?
I UNDEFINE and DEFINE into WCONNECT_OVERRIDE.H file.
Do I write the new Open method in MyAppProcess.prg?
Open method is only a part of the wwBusiness class, so must I write the full wwBusiness class code in MyAppProcess as MyBusiness class?
Thank you very much for patience.


You should never modify the base classes as they WILL get overwritten in updates. Whenever possible subclass any Web COnnection classes and they use those sub-classes instead. Most Web Connection classes are defined in WCONNECT.h as #DEFINE statements. For example:

#DEFINE WWC_RESPONSE wwResponse #DEFINE WWC_RESPONSEFILE wwResponseFile #DEFINE WWC_RESPONSESTRING wwResponseStringNoBuffer #DEFINE WWC_RESPONSEASP wwASPResponse

To change any of those classes create your subclass and then add the following into WCONNECT_OVERRIDE.H:

#UNDEFINE WWC_REQUEST #DEFINE WWC_REQUEST myRequest #UNDEFINE WWC_WWPDF #DEFINE WWC_WWPDF wwXFRX

Then if you need to explicitly instantiate these classes use:

loPdf = CREATEOBJECT([WWC_WWPDF])

The #DEFINEs are important because they are used internally in Web Connection to instantiate objects used inside of the frameowrk where you can control the object creation. In MOST (but not all) places Web Connection uses the above syntax to create objects.

+++ Rick ---


Dear Rick,
by developing my new application sometime I have to customize original Classes: I comment original code, then I write my customized code.
However I fear that future upgrades could overwrite original Classes and so I could lose my customizations.
Please is there any better way to customize?
Thank you very much again for your great software and for your precious support!










Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii
West Wind Web Monitor

Viewing all articles
Browse latest Browse all 10393

Trending Articles