Implement unique IDs for settings.
This commit is contained in:
parent
286ddb1641
commit
9fd0907310
@ -47,6 +47,12 @@ namespace zaaReloaded2.Controller
|
||||
/// </summary>
|
||||
public IList<ElementBase> Elements { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique ID of this Settings object. The unique
|
||||
/// ID is not included in deep-copying (cloning).
|
||||
/// </summary>
|
||||
public Guid Uid { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -54,6 +60,7 @@ namespace zaaReloaded2.Controller
|
||||
public Settings()
|
||||
{
|
||||
Elements = new List<ElementBase>();
|
||||
Uid = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public Settings(string name)
|
||||
|
@ -76,6 +76,21 @@ namespace zaaReloaded2.Controller
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a Settings object contained in this repository
|
||||
/// by unique ID.
|
||||
/// </summary>
|
||||
/// <param name="uid">GUID to look for.</param>
|
||||
/// <returns>Settings object with this GUID, or null if the
|
||||
/// GUID was not found.</returns>
|
||||
public Settings FindByGuid(Guid uid)
|
||||
{
|
||||
return SettingsList.FirstOrDefault(s => s.Uid == uid);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user