Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2037 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
8 changed files with 166 additions and 313 deletions
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
${StandardHeader.C#} |
||||
|
||||
using System; |
||||
using System.Configuration; |
||||
|
||||
namespace ${StandardNamespace} |
||||
{ |
||||
public sealed class ${ClassName}Element : ConfigurationElement |
||||
{ |
||||
/// <summary>
|
||||
/// The attribute <c>name</c> of a <c>${ClassName}Element</c>.
|
||||
/// </summary>
|
||||
[ConfigurationProperty("name", IsKey = true, IsRequired = true)] |
||||
public string Name |
||||
{ |
||||
get { return (string)this["name"]; } |
||||
set { this["name"] = value; } |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// A demonstration of how to use a boolean property.
|
||||
/// </summary>
|
||||
[ConfigurationProperty("special")] |
||||
public bool IsSpecial { |
||||
get { return (bool)this["special"]; } |
||||
set { this["special"] = value; } |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
${StandardHeader.C#} |
||||
|
||||
using System; |
||||
using System.Configuration; |
||||
|
||||
|
||||
namespace ${StandardNamespace} |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ${ClassName}.
|
||||
/// </summary>
|
||||
public sealed class ${ClassName}Collection : ConfigurationElementCollection |
||||
{ |
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CollectionType of the ConfigurationElementCollection.
|
||||
/// </summary>
|
||||
public override ConfigurationElementCollectionType CollectionType |
||||
{ |
||||
get { return ConfigurationElementCollectionType.BasicMap; } |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Name of Elements of the collection.
|
||||
/// </summary>
|
||||
protected override string ElementName |
||||
{ |
||||
get { return "${ClassName}"; } |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve and item in the collection by index.
|
||||
/// </summary>
|
||||
public ${ClassName}Element this[int index] |
||||
{ |
||||
get { return (${ClassName}Element)BaseGet(index); } |
||||
set |
||||
{ |
||||
if (BaseGet(index) != null) |
||||
{ |
||||
BaseRemoveAt(index); |
||||
} |
||||
BaseAdd(index, value); |
||||
} |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Adds a ${ClassName}Element to the configuration file.
|
||||
/// </summary>
|
||||
/// <param name="element">The ${ClassName}Element to add.</param>
|
||||
public void Add(${ClassName}Element element) |
||||
{ |
||||
BaseAdd(element); |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ${ClassName}Element.
|
||||
/// </summary>
|
||||
/// <returns>A new <c>${ClassName}Element</c></returns>
|
||||
protected override ConfigurationElement CreateNewElement() |
||||
{ |
||||
return new ${ClassName}Element(); |
||||
} |
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key of an element based on it's Id.
|
||||
/// </summary>
|
||||
/// <param name="element">Element to get the key of.</param>
|
||||
/// <returns>The key of <c>element</c>.</returns>
|
||||
protected override object GetElementKey(ConfigurationElement element) |
||||
{ |
||||
return ((${ClassName}Element)element).Name; |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes a ${ClassName}Element with the given name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the ${ClassName}Element to remove.</param>
|
||||
public void Remove (string name) { |
||||
base.BaseRemove(name); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
${StandardHeader.C#} |
||||
|
||||
using System; |
||||
using System.Configuration; |
||||
|
||||
namespace ${StandardNamespace} |
||||
{ |
||||
/// <summary>
|
||||
/// Configuration settings for ${ClassName}.
|
||||
/// </summary>
|
||||
public class ${ClassName}Section : ConfigurationSection |
||||
{ |
||||
/// <summary>
|
||||
/// Collection of tables (auctually views) to generate
|
||||
/// reports from.
|
||||
/// </summary>
|
||||
[ConfigurationProperty("customSection", IsDefaultCollection = true)] |
||||
public ${ClassName}Collection ${ClassName} |
||||
{ |
||||
get { return (${ClassName}Collection) base["customSection"]; } |
||||
} |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue