Passing connection among classes 
Author Message
 Passing connection among classes

As I read about 3-tier models and classes, etc., it seems to me that I
should create an ActiveX component that will handle the data for my
application.

So I create a component to provide objects for TableA. I also want to create
a component that will handle the connection to the database (production,
training, development).  But now, I think that I am sending objects back and
forth.

For example;
1. AppExe calls LoginDLL
2. LoginDLL presents a login dialog box, builds a connect string, and tests
the connection (currently RDO)
3. AppExe now needs some data, so it calls DataExe (server-based ActiveX
exe?)

Do I send a connection object to DataExe? Just a connect string?

Any thoughts from the VB community are appreciated.



Fri, 29 Sep 2000 03:00:00 GMT  
 Passing connection among classes

Paul
I was looking at the same thing, and concluded that as all the objects are
passed by reference this is only a few bytes anyway. As I'm a newbie I'd
like to have it confirmed.

Peter
--

using
Office97 sp1, VB5.0 sp3, SQL6.5 sp3, Win95, NT4.0WS, NT4.0 sp3 Servers



Quote:
> As I read about 3-tier models and classes, etc., it seems to me that I
> should create an ActiveX component that will handle the data for my
> application.

> So I create a component to provide objects for TableA. I also want to
create
> a component that will handle the connection to the database (production,
> training, development).  But now, I think that I am sending objects back
and
> forth.

> For example;
> 1. AppExe calls LoginDLL
> 2. LoginDLL presents a login dialog box, builds a connect string, and
tests
> the connection (currently RDO)
> 3. AppExe now needs some data, so it calls DataExe (server-based ActiveX
> exe?)

> Do I send a connection object to DataExe? Just a connect string?

> Any thoughts from the VB community are appreciated.



Sat, 30 Sep 2000 03:00:00 GMT  
 Passing connection among classes


says...

Quote:

>Paul
>I was looking at the same thing, and concluded that as all the objects are
>passed by reference this is only a few bytes anyway. As I'm a newbie I'd
>like to have it confirmed.
>...

If you pass a parameter by reference when calling a COM object on a different
machine DCOM will copy the data from client to server run the routine and copy
the data back again.  It has to do this to fool the server routine into
thinking that it has a direct pointer to the parameter.  This means that if you
don't need any feedback in that parameter it is actually cheaper in run time to
use ByVal.  Seems stupid I know but there is some logic there.

--
Kevin Whitefoot, IT Centre, ABB Kraft AS, Drammen, Norway.



Sun, 01 Oct 2000 03:00:00 GMT  
 Passing connection among classes

I have faced similar problems in the past and have found passing object
references via DCOM very dodgy. I generally avoid it by copying the class
values.
For example
If you create a copy to method for each class that may need to be copyied
via DCOM use the following:
        cliClass.copyto (svrClass)

The functionality of the copyto metod is obvious and very simple, is you
use collection wrappers then the wrapper merely has to reference the copyto
method for each item in the collection, and hey presto.

Darren



Quote:

> says...

> >Paul
> >I was looking at the same thing, and concluded that as all the objects
are
> >passed by reference this is only a few bytes anyway. As I'm a newbie I'd
> >like to have it confirmed.
> >...
> If you pass a parameter by reference when calling a COM object on a
different
> machine DCOM will copy the data from client to server run the routine and
copy
> the data back again.  It has to do this to fool the server routine into
> thinking that it has a direct pointer to the parameter.  This means that
if you
> don't need any feedback in that parameter it is actually cheaper in run
time to
> use ByVal.  Seems stupid I know but there is some logic there.

> --
> Kevin Whitefoot, IT Centre, ABB Kraft AS, Drammen, Norway.



Tue, 03 Oct 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing connection among classes

2. Sharing classes among various applications

3. Passing a socket connection to a class

4. Sharing Data among class instances

5. Passing ADO Connection to class

6. VB OOP question: Passing ADO recordsets among objects!

7. VB OOP question: Passing ADO recordsets among objects!

8. VB OOP question: Passing ADO recordsets among objects!

9. Pass Class reference of unkown class

10. Pass integer Value from forms Class mod to report class mod

11. Passing Classes to other classes (using user defined types)

12. ADO connection passed to a DLL fails to maintain valid connection

 

 
Powered by phpBB® Forum Software