public override void Initialize(string name, NameValueCollection config)
{
if (config == null)
{
throw new ArgumentNullException("config");
}
if (String.IsNullOrEmpty(name))
{
name = "DbBlogProvider";
}
if (String.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Generic Database Blog Provider");
}
base.Initialize(name, config);
if (config["connectionStringName"] == null)
{
// default to BlogEngine
config["connectionStringName"] = "BlogEngine";
}
this.connStringName = config["connectionStringName"];
config.Remove("connectionStringName");
if (config["tablePrefix"] == null)
{
// default
config["tablePrefix"] = "be_";
}
this.tablePrefix = config["tablePrefix"];
config.Remove("tablePrefix");
if (config["parmPrefix"] == null)
{
// default
config["parmPrefix"] = "@";
}
this.parmPrefix = config["parmPrefix"];
config.Remove("parmPrefix");
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
var attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
{
throw new ProviderException(string.Format("Unrecognized attribute: {0}", attr));
}
}
}