83 lines
2 KiB
C#
83 lines
2 KiB
C#
using System;
|
|
using JD.Serializers.Xml;
|
|
|
|
namespace JD.PropertyService
|
|
{
|
|
/// <summary>
|
|
/// Read-Only properties.
|
|
/// </summary>
|
|
internal class ReadOnlyProperties : PropertiesWrapper
|
|
{
|
|
#region Constructor
|
|
|
|
internal ReadOnlyProperties(IProperties properties)
|
|
: base(properties)
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public override bool IsReadOnly
|
|
{
|
|
get { return true; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
public override void Set<T>(string key, T value)
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override bool Remove(string propertyName)
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override void Clear()
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override IProperties CreateSubKey(string key, AccessContext mode)
|
|
{
|
|
if (mode == AccessContext.Write)
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
return base.CreateSubKey(key, mode);
|
|
}
|
|
|
|
public override bool RemoveSubKey(string key, AccessContext mode)
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override bool Save()
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override IDisposable BeginScopedUpdate()
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override void EndUpdate()
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
public override void ReadFromXml(XmlSerializerReader serializer)
|
|
{
|
|
throw new InvalidOperationException("Properties are read only.");
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|