refactoring
This commit is contained in:
parent
347ffc8a5a
commit
b5d19c5da6
38 changed files with 149 additions and 117 deletions
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
|
||||
public class BlogProviderConfigurationElement : ConfigurationElement
|
||||
{
|
||||
[ConfigurationProperty("name", IsRequired = true, IsKey=true)]
|
||||
public string Name {
|
||||
get { return (string)this ["name"]; }
|
||||
set { this ["name"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("type", IsRequired = true, IsKey=false)]
|
||||
public string Type {
|
||||
get { return (string)this ["type"]; }
|
||||
set { this ["type"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("connectionStringName")]
|
||||
public string ConnectionStringName {
|
||||
get { return (string)this ["connectionStringName"]; }
|
||||
set { this ["connectionStringName"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("description")]
|
||||
public string Description {
|
||||
get { return (string)this ["description"]; }
|
||||
set { this ["description"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("applicationName")]
|
||||
public string ApplicationName {
|
||||
get { return (string)this ["applicationName"]; }
|
||||
set { this ["applicationName"] = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
public class BlogProvidersConfigurationCollection : ConfigurationElementCollection
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new BlogProviderConfigurationElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((BlogProviderConfigurationElement) element).Name;
|
||||
}
|
||||
|
||||
public BlogProviderConfigurationElement GetElement (string name)
|
||||
{
|
||||
return this.BaseGet(name) as BlogProviderConfigurationElement;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
public class BlogProvidersConfigurationSection : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the default provider.
|
||||
/// </summary>
|
||||
/// <value>The default provider.</value>
|
||||
[ConfigurationProperty("defaultProvider")]
|
||||
public string DefaultProvider {
|
||||
get { return (string) this ["defaultProvider"]; }
|
||||
set { this["defaultProvider"] = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[ConfigurationProperty("providers")]
|
||||
[ConfigurationCollection(typeof(BlogProvidersConfigurationCollection),
|
||||
AddItemName = "add",
|
||||
ClearItemsName = "clear",
|
||||
RemoveItemName = "remove")]
|
||||
/// <summary>
|
||||
/// Gets or sets the providers.
|
||||
/// </summary>
|
||||
/// <value>The providers.</value>
|
||||
public BlogProvidersConfigurationCollection Providers{
|
||||
get { return (BlogProvidersConfigurationCollection) this["providers"]; }
|
||||
set { this["providers"] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue