31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
namespace Prefab.Base;
|
|
|
|
/// <summary>
|
|
/// Contract for models that expose a customizable attribute bag to module developers.
|
|
/// </summary>
|
|
public interface ICanBeCustomized : IHasGenericAttributes
|
|
{
|
|
/// <summary>
|
|
/// Sets or updates a custom attribute value.
|
|
/// </summary>
|
|
/// <param name="key">The attribute name.</param>
|
|
/// <param name="value">The value to store.</param>
|
|
void SetAttribute(string key, object value);
|
|
|
|
/// <summary>
|
|
/// Removes a custom attribute by key.
|
|
/// </summary>
|
|
/// <param name="key">The attribute to remove.</param>
|
|
/// <returns><c>true</c> when the key existed and was removed.</returns>
|
|
bool RemoveAttribute(string key);
|
|
|
|
/// <summary>
|
|
/// Attempts to read an attribute value.
|
|
/// </summary>
|
|
/// <param name="key">The attribute to inspect.</param>
|
|
/// <param name="value">Receives the typed attribute value when present.</param>
|
|
/// <typeparam name="T">The expected attribute type.</typeparam>
|
|
/// <returns><c>true</c> when the attribute exists and matches the requested type.</returns>
|
|
bool TryGetAttribute<T>(string key, out T value);
|
|
}
|