Added documentation

This commit is contained in:
Thorsten Sommer 2025-07-31 15:51:41 +02:00
parent 695cc4cbbb
commit 7a35626c91
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -6,6 +6,12 @@ public sealed class SettingsLocker
{
private readonly Dictionary<string, Dictionary<string, Guid>> lockedProperties = new();
/// <summary>
/// Registers a property of a class to be locked by a specific configuration plugin ID.
/// </summary>
/// <param name="propertyExpression">The property expression to lock.</param>
/// <param name="configurationPluginId">The ID of the configuration plugin that locks the property.</param>
/// <typeparam name="T">The type of the class that contains the property.</typeparam>
public void Register<T>(Expression<Func<T, object>> propertyExpression, Guid configurationPluginId)
{
var memberExpression = propertyExpression.GetMemberExpression();
@ -18,6 +24,11 @@ public sealed class SettingsLocker
this.lockedProperties[className].TryAdd(propertyName, configurationPluginId);
}
/// <summary>
/// Removes the lock for a property of a class.
/// </summary>
/// <param name="propertyExpression">The property expression to remove the lock for.</param>
/// <typeparam name="T">The type of the class that contains the property.</typeparam>
public void Remove<T>(Expression<Func<T, object>> propertyExpression)
{
var memberExpression = propertyExpression.GetMemberExpression();
@ -35,6 +46,12 @@ public sealed class SettingsLocker
}
}
/// <summary>
/// Gets the configuration plugin ID that locks a specific property of a class.
/// </summary>
/// <param name="propertyExpression"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public Guid GetConfigurationPluginId<T>(Expression<Func<T, object>> propertyExpression)
{
var memberExpression = propertyExpression.GetMemberExpression();