Hi,
I am trying to implement the provider pattern in a custom web control. I am still trying to understand the pattern and I have the following questions.
Is the default provider the provider that is always going to be used when my control loads? From what I can tell the provider used will always be the default but I am not sure because the MSDN documentation says that server controls that allow selection of Providers should have Provider property that should default to the value of the defaultProvider. To me that means the control can load a a given provider based on it's Provider property as long as that provider is in the Config file. Is that correct? So the default provider is returned if no specific provider is requested.
To change providers do I just simply change the defaultprovider in my config file? <-- I think that is incorrect as that would just change the defaultProvider returned.
Is this correct: In a control then the defaultprovider would be loaded in the OnLoad event method of the control? I need to pass the control data from different sources depending on the provider but the resulting data would then be put into a class. that the control would use to render itself.
I am also confused how to get the data to the control from the page? Say my ProviderBase had a method called LoadData
Then in my SQLCustomerProvider I would implement the LoadData method, is it ok to customize this code here to read my specific data and load into the class or should the page using the control load the data into the class?
Thanks!