Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Processes
Message
General information
Forum:
Visual FoxPro
Category:
COMCodebook
Title:
Miscellaneous
Thread ID:
00698649
Message ID:
00699530
Views:
18
Hey Achim,

Yes your Process objects are the right place to do this. They are just subclasses of the RMController so you would get transactions and saving abilities for free.

If you want to work with different databases, just make sure you have built the DataSource objects properly. You do this by setting the appropriate properties in your datasource class. For Oracle this would be:
cADOComponentsParameterClass = "ADOComponentsParameter_ORACLE" &&Inherit from IADOComponentsParameter

cSearchSyntaxClass = "SearchSyntax_ORACLE" &&Inherit from IOracleSearchSyntax

cConfigurationObjectClass = "prm_Connection_ORACLE" &&Inherit from IOleDbProviderForOracle
Then you create an a-layer process object by inheriting from IRMController and writing the appropriate methods. You may want to mark the Set_up_Environment(), MarshallData() and Save() functions as PROTECTED so that your clients are only allowed to call your process methods. Your process methods will call these functions internally when you save. For example:
*************************************************************
DEFINE CLASS MyProcess AS iRMController OLEPUBLIC
*************************************************************
  Name	= "MyProcess"

  PROTECTED FUNCTION Set_Up_Environment( tcXMLEnvironment )
	Return DoDefault( tcXMLEnvironment )
  ENDFUNC
	
  PROTECTED FUNCTION MarshallData( toADORS, tcResourceManagerName )
	Return DoDefault( toADORS, tcResourceManagerName )
  ENDFUNC
	
  PROTECTED FUNCTION Save( rxMsgSvc )
 	Return DoDefault( @rxMsgSvc )
  ENDFUNC

  FUNCTION GetMultiDatabaseResource()
     *-- Perform your processes on the *outgoing* resource as neccessary.

    o1=createob("sqlrmg.test")
    o2=createob("orarmg.test")
    rs1=o1.getproxy()
    rs2=o2.getproxy()

    rs1.fields(0).value=rs2.fields(3).value
 
    RETURN rs1

  ENDFUNC

  FUNCTION SaveMultiDatabaseResource(rs1, rxMsgSvc)
     LOCAL lnRetVal

     *-- Perform your processes on the *incoming* resource as neccessary.
     *-- This can include evaluating the data, modifying it, 
     *-- calling up new resources from different datasources and 
     *-- and adding rows to it (which would maybe add records to a 
     *-- workflow table < g>) or you could even split the incoming 
     *-- resource into multiple resources that the datasources
     *-- could handle. When you call Save(), all of this would be
     *-- wrapped in a COM+ transaction.
     
     *-- After processing, set up your environment string like normal... 
     LOCAL lcXMLEnvironment
     lcXMLEnvironment = "<TABLE><ROW>" + ;
          "<CRMPNAME>RMSql</CRMPNAME>" + ;
          "<CRMCLSNAME>sqlrmg.test</CRMCLSNAME>" + ;
          "<NSAVEORDER>1.00</NSAVEORDER>" + ;
          "<CPARNTRELA></CPARNTRELA>" + ;
          "<LPRIMARY>F</LPRIMARY>" + ;
          "<CKEYFIELD>nID</CKEYFIELD>" + ;
          "</ROW><ROW>" + ;
          "<CRMPNAME>RMOracle</CRMPNAME>" + ;
          "<CRMCLSNAME>oramg.test</CRMCLSNAME>" + ;
          "<NSAVEORDER>2.00</NSAVEORDER>" + ;
          "<CPARNTRELA></CPARNTRELA>" + ;
          "<LPRIMARY>F</LPRIMARY>" + ;
          "<CKEYFIELD>nID</CKEYFIELD>" + ;
          "</ROW></TABLE>"

     *--Instantiate the Resource managers named in the string above
     This.Set_Up_Environment( lcXMLEnvironment )
 
     *--Marshal the appropriate resources to the resource managers
     This.MarshallData( rs1, "RMSql")
     This.MarshallData( rs1, "RMOracle")
     rs1 = Null

     lnRetVal = This.Save( @rxMsgSvc )

     RETURN lnRetVal
    
  ENDFUNC

ENDDEFINE
***************************************************************
I hope this answers your questions.

Have fun!
-B



>Hallo Jayesh ,
>
>I want to work with Resources from different databases:
>
>o1=createob("sqlrmg.test")
>o2=createob("orarmg.test")
>rs1=o1.getproxy()
>rs2=o2.getproxy()
>
>rs1.fields(0).value=rs2.fields(3).value
>
>return rs1
>
>It seems the processobject is the right place to do this.
>
>achim
Beth Massi
Program Manager
Visual Studio Community
Microsoft Corporation
http://blogs.msdn.com/bethmassi
http://mdsn.com/vbasic
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform