Mitchel's Forums

Subject: Problem understanding usage pattern of DataProviders, ServiceProviders and Controller Classes
Prev Next
You are not authorized to post a reply.

AuthorMessages
r_honeyUser is Offline
Heavy Poster
Heavy Poster
Posts:77

05/25/2008 8:35 AM  

The first service in DNN I explored for customization was the Role Service. That service has RoleController under Security in Components, a DNNRoleProvider in a separate project named Provider.Membership.DNNProvider and a DataProvider again in a separate project named Provider.Membership.DataProvider.

The norm here is that the UI CodeBehinds call the RoleController, which uses the DNNRoleProvider which in turn uses the DataProvider, i.e. an architecture something like:

Controller -> ServiceProvider -> ServiceDataProvider

However, in the case of Caching service, it is the BPCachingProvider that uses CachingController which uses the DataProvider, i.e.

ServiceProvider -> Controller -> ServiceDataProvider

Now, which way it should be? Should controller use ServiceProviders, or ServiceProviders should use Controllers??

In majority of the cases (Role, Profile, Membership), I have observed that it is the Controller that calls the ServiceProvider. So, why an exception in Caching Service?

 

One more thing I have observed is that there is a common DataProvider for multiple services (e.g. Membership, Profile & Role Provider share the same Abstract & Concrete DataProvider). Shouldn't there be separate Abstract DataProviders for each service. e.g. I want to customize how the Lists are handled in the database (whose abstract methods are present in the main DataProvider class of DNN), but have no option but to handle Portal, Tab, SearchEngine, Files & a hec lot of other Methods that I dont want to play with???

Would it be a good idea to inherit from the main SqlDataProvider of DNN, override List Handling methods & leave the other ones upto the base class???

Mitchel SellersUser is Offline
Site Admin/Owner
Guru
Guru
Posts:5644

05/27/2008 11:20 AM  
I cannot answer to the difference of the caching system, however, I can say that you are correct that the controller is to call the data provider, or other providers if necessary.

The DNN core system is slightly different in its implementation of the SQLDataProvider in that it has one provider to host all of its common methods. Modules and other non-core components have only their own code inside their SQLDataProvider files.

Depending on your needs your modifications might work, however, I would strongly advise looking into methods of updating it WITHOUT modifying the core....as any time you modify the core, you take yourself outside of an upgrade path.

-Mitchel Sellers
MCITP, MCPD, MCTS
Director of Development
IowaComputerGurus Inc.

View Mitchel Sellers's profile on LinkedIn

3Essentials is my recommended Shared Hosting Provider

This site is hosted on a VPS from HostMySIte.com

Mosso is my recommended cloud computing provider. Use reference code REF-ICG to get $100 off your second month!

To get Guaranteed DNN Support check out our affordable DNN Technical Support Programs
r_honeyUser is Offline
Heavy Poster
Heavy Poster
Posts:77

05/27/2008 11:25 AM  

Exactly for that reason, I proposed to inherit (or extend the base SqlDataProvider) without modifying it directly. That way, I can provide my logic for some methods that need to be tweaked, and the rest of all can be left to the Base Provider.

In effect, I achieve both, avoiding writing methods that I dont want to modify, as well as leaving the core intact!!!

Mitchel SellersUser is Offline
Site Admin/Owner
Guru
Guru
Posts:5644

05/27/2008 11:29 AM  
Yes, you are correct, if you are going to modify that is the least risky way to do it....

Then you are really only at risk if any of your overwritten methods change in signature or name.

-Mitchel Sellers
MCITP, MCPD, MCTS
Director of Development
IowaComputerGurus Inc.

View Mitchel Sellers's profile on LinkedIn

3Essentials is my recommended Shared Hosting Provider

This site is hosted on a VPS from HostMySIte.com

Mosso is my recommended cloud computing provider. Use reference code REF-ICG to get $100 off your second month!

To get Guaranteed DNN Support check out our affordable DNN Technical Support Programs
You are not authorized to post a reply.
Forums >Development Discussion >DotNetNuke > Problem understanding usage pattern of DataProviders, ServiceProviders and Controller Classes



ActiveForums 3.7