Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

WebDataProvider's Factory Support

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

I'm trying to understand how does factory support works for WebDataProvider.

Is this feature useful when the programmer don't want to add too many WebDataProviders into the TFPWebProviderDataModule?.

It is possible to define the WebDataProviders in their own unit (by code), then, in the TFPWebProviderDataModule register all providers with RegisterProvider, to let the module know about them?.

If factory support's rationale is to avoid WebProviderDataModules full of WebDataProviders, why not just divide the app with many datamodules containing only some WebDataProviders?.

Reply by email

Michael Van Canneyt
to Leonardo M. Ramé
Leonardo M. Ram? wrote 5 lines
I'm trying to understand how does factory support works for WebDataProvider. Is this feature useful when the programmer don't want to add too many WebDataProviders into the TFPWebProviderDataModule?.

yes.

It is possible to define the WebDataProviders in their own unit (by code), then, in the TFPWebProviderDataModule register all providers with RegisterProvider, to let the module know about them?.

You can do this.

How we work at my job is: create N datamodules with WebDataProviders, and at program startup, register all the datamodules in the factory.

There is exactly 1 TFPWebProviderDataModule which has the option set to check the factory registry. It is registered with URL /Providers.

If factory support's rationale is to avoid WebProviderDataModules full of WebDataProviders, why not just divide the app with many datamodules containing only some WebDataProviders?.

To have a single url. If you make many TFPWebProviderDataModules, they must all be registered with their own URL. The factory system allows to have a single entry point.

All providers in my application are then accessible from /Providers/ProviderName/Read
(and of course create/update/delete)

I created a Ext.data.Store descendent which has the URL and naming scheme coded in so all I must do is
mystore = new WISA.ClientDataset ({
ProviderName : 'MyData'
});
To access the data.

Michael.

Reply by email

Leonardo M. Ramé
to Michael Van Canneyt
Michael Van Canneyt wrote 12 lines
>It is possible to define the WebDataProviders in their own unit (by >code), then, in the TFPWebProviderDataModule register all providers with RegisterProvider, >to let the module know about them?. You can do this. How we work at my job is: create N datamodules with WebDataProviders, and at program startup, register all the datamodules in the factory. There is exactly 1 TFPWebProviderDataModule which has the option set to check the factory registry. It is registered with URL /Providers.

Ok, that way all datamodules (except the one that you mentioned) are just containers of WebDataProviders, until the moment where a request needs one of them, then, the factory creates an instance of the required one.

Much clear now, thanks Michael.

Reply by email