On 2010-10-16 12:18:30 +0200, Michael Van Canneyt wrote: > > > > >I attached a proof of concept, take a look and comment. > > Seems like a very good start, some suggestions: > > 1. You created something which is by definition non-visual ? > Why not make the TDynamicSQLWebProvider a component which you can drop on > a webmodule ? > > 2. Having done 1, you could rework TModuleProvider so it recognizes and uses > a TDynamicSQLWebProvider dropped on it. > (if I understand correctly, there is no need to do anything, it would be > automatic if the > TDynamicSQLWebProvider uses it's owner as the owner for the providers) > > 3. Why not create the providers on an as-needed basis ? > Now you create all registered providers. > If you override the GetProvider method in TModuleProvider, you can simply > create the instance you actually need. > > My projects contain typically 1000+ providers. > If I would create them all in memory per connection - memory consumption > would rocket sky high :-) > > I would simply load the definitions - once - and then create providers on > an as-needed basis. > > 4. You forgot the XMLprovider unit :-) > Seems like you make it a procedural interface to load the definitions. > I would expect that TSqlWebDataProviders has a virtual abstract method > which loads the definitions from file: > Procedure LoadFromFile(Const AFileName : String); virtual; Abstract; > In the case of a component, there could even be a 'FileName' property, > read in the 'Loaded' method. > then create a descendent which loads from whatever file format is fitting. > > 5. Advanced concept: > Why didn't you use the TFPWebDataProviderManager factory class ? (see > demo5) > > It is built for this kind of thing. (I currently use that at work) : you > register all providers there. > TFPWebProviderDataModule knows about this class and fetches a provider > there on-demand. > All you'd need to do is register 1 TModuleProvider instance there. This > is optional of course. > So in fact, there are 2 paths you could follow. > > I hope all this makes sense :-) > > Michael.
Thanks, I'll try to implement this next week. -- Leonardo M. Ramé http://leonardorame.blogspot.com -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
