using System; using System.Collections.Generic; using System.Text; namespace Esiur.Net.IIP; public interface IDistributedPropertyContext { object GetValue(DistributedConnection connection); } public class DistributedPropertyContext : IDistributedPropertyContext { public T Value { get; private set; } public DistributedConnection Connection { get; private set; } public Func Method { get; private set; } public DistributedPropertyContext(DistributedConnection connection, T value) { this.Value = value; this.Connection = connection; } public DistributedPropertyContext(Func method) { this.Method = method; } public static implicit operator DistributedPropertyContext(Func method) => new DistributedPropertyContext(method); public object GetValue(DistributedConnection connection) { return Method.Invoke(connection); } }