2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2025-05-30 18:00:10 +03:00
parent 276e7b17fd
commit a720b11959
10 changed files with 58 additions and 33 deletions

View File

@ -1909,7 +1909,7 @@ partial class DistributedConnection
if (pi.PropertyType.IsGenericType && pi.PropertyType.GetGenericTypeDefinition()
== typeof(DistributedPropertyContext<>))
== typeof(PropertyContext<>))
{
value = Activator.CreateInstance(pi.PropertyType, this, value);
//value = new DistributedPropertyContext(this, value);

View File

@ -4,30 +4,30 @@ using System.Text;
namespace Esiur.Net.IIP;
public interface IDistributedPropertyContext
public interface IPropertyContext
{
object GetValue(DistributedConnection connection);
}
public class DistributedPropertyContext<T> : IDistributedPropertyContext
public class PropertyContext<T> : IPropertyContext
{
public T Value { get; private set; }
public DistributedConnection Connection { get; private set; }
public Func<DistributedConnection, T> Method { get; private set; }
public DistributedPropertyContext(DistributedConnection connection, T value)
public PropertyContext(DistributedConnection connection, T value)
{
this.Value = value;
this.Connection = connection;
}
public DistributedPropertyContext(Func<DistributedConnection, T> method)
public PropertyContext(Func<DistributedConnection, T> method)
{
this.Method = method;
}
public static implicit operator DistributedPropertyContext<T>(Func<DistributedConnection, T> method)
=> new DistributedPropertyContext<T>(method);
public static implicit operator PropertyContext<T>(Func<DistributedConnection, T> method)
=> new PropertyContext<T>(method);
public object GetValue(DistributedConnection connection)
{