Implement singleton pattern for thesauruses.
This commit is contained in:
parent
b421279208
commit
26766dbf81
@ -107,8 +107,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
|||||||
|
|
||||||
public ZaaImporter()
|
public ZaaImporter()
|
||||||
{
|
{
|
||||||
_parameters = new Parameters();
|
_parameters = Parameters.Default;
|
||||||
_units = new Units();
|
_units = Units.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -32,6 +32,24 @@ namespace zaaReloaded2.Thesaurus
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Parameters : ThesaurusBase
|
public class Parameters : ThesaurusBase
|
||||||
{
|
{
|
||||||
|
#region Singleton
|
||||||
|
|
||||||
|
private static readonly Parameters _default = new Parameters();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default singleton instance of the Parameters
|
||||||
|
/// thesaurus.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://csharpindepth.com/Articles/General/Singleton.aspx#cctor
|
||||||
|
/// </remarks>
|
||||||
|
public static Parameters Default { get { return _default; } }
|
||||||
|
|
||||||
|
static Parameters() { }
|
||||||
|
private Parameters() { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Public methods
|
#region Public methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -100,5 +118,6 @@ namespace zaaReloaded2.Thesaurus
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,23 @@ namespace zaaReloaded2.Thesaurus
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Units : ThesaurusBase
|
public class Units : ThesaurusBase
|
||||||
{
|
{
|
||||||
|
#region Singleton
|
||||||
|
|
||||||
|
private static readonly Units _default = new Units();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default singleton instance of the Units thesaurus.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://csharpindepth.com/Articles/General/Singleton.aspx#cctor
|
||||||
|
/// </remarks>
|
||||||
|
public static Units Default { get { return _default; } }
|
||||||
|
|
||||||
|
static Units() { }
|
||||||
|
private Units() { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Public methods
|
#region Public methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user