from where is Instance actually instantiated?
Dear Developers,
I can't quite fully understand the details of the Instance machanism in this framework, could someone please explain how it works? For example, lets take Articles:
The text says that
"Once the provider is created for the first time, it is saved in a static private property and won't be recreated again until the web application is shut down and restarted (for example, when IIS is stopped and restarted, or when the web.config file is changed"
There are calls such as this:
---
List<ArticleDetails> recordset = SiteProvider.Articles.GetArticles(
categoryID, GetPageIndex(startRowIndex, maximumRows), maximumRows);
---
In my understanding this call references the static private property and calls its GetArticles() method, right???
But where is the statement that calls the following code in order to create the instance the first time the application is started?
static private ArticlesProvider _instance = null;
/// <summary>
/// Returns an instance of the provider type specified in the config file
/// </summary>
static public ArticlesProvider Instance
{
get
{
if (_instance == null)
_instance = (ArticlesProvider)Activator.CreateInstance(
Type.GetType(Globals.Settings.Articles.ProviderTyp e));
return _instance;
}
}
}
}
Thanks!
__________________
Alex
- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
|