Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird problem with N-Tier + ADO RecordSet
Message
 
 
À
12/09/2001 05:15:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00555402
Message ID:
00557190
Vues:
13
Hi!

Because marchalling. When passing object through COM/DCOM barrier, object's class knows how to pass it through, for example, disconnected ADO recordset know how to go through this barrier. When you access properties from the client to object on the server, it knows only how to access them, but it could be that changing something will change other properties of that object that will not be immediately visible at the client side causing client-side application see other properties in inconsysten state. I even really wondered why COM barrier allows to read custom-added properties to the fields collection of ADO, but seems it is buried somewhere in ADO.

>Hi, Everybody.
>
>I´m developing my framework in a N-Tier approach, based upon Doug Hennig´s Article on CoDe Magazine.
>
>Well... I have a Data Services Class, a Business Services Class, and a UI Class... in my UI Class (indeed, this is the host class that will be linked in my visual classes...) I have a definition like this:
>
>DEFINE CLASS uipaciente AS custom OLEPUBLIC
>
> opaciente = .NULL.
> orspaciente = .NULL.
> Name = "uipaciente"
>
>PROCEDURE Init
> WITH This
> *** this property hosts my business object
> *** (... and my business object hosts a Dataclass object)
> .oPaciente = CreateObject("pacientes.paciente")
>
> *** this property hosts a RecordSet, that will be
> *** filled by my business object
> .oRSPaciente = CreateObject("ADODB.RecordSet")
> ENDWITH
>ENDPROC
>
>****
>** Well, if I instantiate my UI class like a VFP Class
>
> loUIPaciente = CreateObject("UIPaciente")
>
>** I can do such thing...
>
>** GetARecordByID
>llOK = loUIPaciente.oPaciente.TrazerPacientePelaID(loUIPaciente.oRSPaciente, 1)
>
>? loUIPaciente.oRSPaciente.fields("c_nome_paciente").value
>
> loUIPaciente.oRSPaciente.fields("c_nome_paciente").value = "A New Value"
>
>? loUIPaciente.oRSPaciente.fields("c_nome_paciente").value
>
>** and my field was changed...
>
>** But, if I instatiate my class like a COM Object...
>
>loUIPaciente = CreateObject("Pacientes.UIPaciente")
>
>** My recordset behave like a ReadOnly recordset...
>
>** but now, if I host my recordset in a memvar
>** everything works fine...
>
>loAnyVar = loUIPaciente.oRSPaciente
>With loAnyVar
> ? .fields("c_nome_paciente").value
> .fields("c_nome_paciente").value = "A new value"
> ? .fields("c_nome_paciente").value
>endwith
>
>
>** Well, OK, I know that, this way, I don´t need to write a big hierarchy, etecetera, but I really would like to know in a techinical way, WHY this happens...
>
>Thanks in advance, and sorry for the little confusing message.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform