PDA

Ver la Versión Completa : DataSnap multiple modulos de datos


belpab
28-04-2008, 20:30:34
Buenas a todos.

Estoy empezando a trabajar con Data Snap y tengo un pequeño problema. Os comento. Estoy intentando pasar una base de datos en Paradox a Firebird y ademas usar DataSnap para asi poder acceder desde otros equipos remotos. Hasta ahi bien. Pero quisiera poder agrupar en remotedatamodules las tablas para asi organizar las tablas en funcion de los formularios que acceden a los mismos, eso sin problemas. Pero para optimizar las conexiones y no abir una conexion por cada Data module estoy intentando hacer un RemoteDataModule padre con una conexion y añadiendo los otros datamodules como una propiedad a la interfac del padre, pero es ahi donde encuentro problemas porque se que eso se puede hacer en la teoria pero en la practica no consigo hacerlo. ¿ Alguien me puede decir como hacerlo o donde puedo encontrar un buen manual para programar con DataSnap o algun ejemplo...?

Gracias de antemano y un saludo.

Al González
28-04-2008, 22:17:08
¡Hola!

...¿ Alguien me puede decir como hacerlo o donde puedo encontrar un buen manual para programar con DataSnap o algun ejemplo...?...
No tengo Delphi instalado en esta máquina pero recuerdo haber visto algo de lo que preguntas en la ayuda de Delphi 7, precisamente ahí viene un tema donde se habla de cómo integrar varios módulos de datos remotos en un solo servidor de aplicaciones (y por lo tanto, infiero, en una sola conexión para tu aplicación cliente).

Échale un vistazo a la ayuda de Delphi, si no encuentras el tema no dejes de externarlo. Probablemente alguno de los compañeros ya lo ha hecho.

Un abrazo remoto.

Al González. :)

belpab
29-04-2008, 16:57:34
nada, sigo sin verlo. En la ayuda no lo encuentro( uso delphi 2006), seguire buscando.
Gracias de igual modo y si hay alguien que me pueda dar luz lo agradeceria.

un saludo

Al González
30-04-2008, 00:46:38
¡Hola!

Ahora sí estoy en mi máquina.

En la ayuda de Delphi 7 (y seguramente en algunas otras versiones también), puede accederse, a través de los temas TRemoteDataModule y Using TRemoteDataModule (Creating the application server), a un enlace titulado Divide your application server into multiple remote data modules (Using multiple remote data modules).

Pegaré aquí el contenido de dicho apartado, creo que es exactamente lo que buscas:


You may want to structure your application server so that it uses multiple remote data modules. Using multiple remote data modules lets you partition your code, organizing a large application server into multiple units, where each unit is relatively self-contained.

Although you can always create multiple remote data modules on the application server that function independently, a special connection component on the DataSnap page of the Component palette provides support for a model where you have one main "parent" remote data module that dispatches connections from clients to other "child" remote data modules. This model requires that you use a COM-based application server (that is, not TSoapDataModule).

To create the parent remote data module, you must extend its IAppServer interface, adding properties that expose the interfaces of the child remote data modules. That is, for each child remote data module, add a property to the parent data module's interface whose value is the IAppServer interface for the child data module. The property getter should look something like the following:


function ParentRDM.Get_ChildRDM: IChildRDM;
begin
if not Assigned(ChildRDMFactory) then
ChildRDMFactory :=
TComponentFactory.Create(ComServer, TChildRDM, Class_ChildRDM,
ciInternal, tmApartment);
Result := ChildRDMFactory.CreateCOMObject(nil) as IChildRDM;
Result.MainRDM := Self;
end;


For information about extending the parent remote data module's interface, see Extending the application server's interface.

Tip
You may also want to extend the interface for each child data module, exposing the parent data module's interface, or the interfaces of the other child data modules. This lets the various data modules in your application server communicate more freely with each other.

Once you have added properties that represent the child remote data modules to the main remote data module, client applications do not need to form separate connections to each remote data module on the application server. Instead, they share a single connection to the parent remote data module, which then dispatches messages to the "child" data modules. Because each client application uses the same connection for every remote data module, the remote data modules can share a single database connection, conserving resources. For information on how child applications share a single connection, see Connecting to an application server that uses multiple data modules.


Espero te sea de utilidad, no dejes de informarnos cómo te fue. ;)

Al.