Esempio n. 1
0
        public static void SetTargetedInterface(long targetedId, IValueInterface <T> valueInterface)
        {
            if (!(Content is TargetedValueInterface <T>))
            {
                if (ContentLock == null)
                {
                    lock (MapersLock)
                    {
                        if (ContentLock == null)
                        {
                            ContentLock = new object();
                        }
                    }
                }

                lock (ContentLock)
                {
                    if (!(Content is TargetedValueInterface <T>))
                    {
                        SetInterface(new TargetedValueInterface <T>(Content));
                    }
                }
            }

            TargetedValueInterface.Set(targetedId, valueInterface);
        }
        public static void SetInterface(IValueInterface <T> valueInterface)
        {
            if (ContentLock is null)
            {
                lock (MapersLock)
                {
                    if (ContentLock is null)
                    {
                        ContentLock = new object();
                    }
                }
            }

            lock (ContentLock)
            {
                valueInterface = valueInterface ?? throw new ArgumentNullException(nameof(valueInterface));

                IsNotModified = false;

                if (Content is TargetedValueInterface)
                {
                    TargetedValueInterface.SetDefaultInterface(valueInterface);
                }
                else
                {
                    Content = valueInterface;
                }
            }
        }
 /// <summary>
 /// 获取针对某一目标值读写器的读写接口实例。
 /// </summary>
 /// <param name="targeted">目标</param>
 /// <returns>返回读写接口实例</returns>
 public static IValueInterface <T> GetTargetedInterface(ITargetedBind targeted)
 {
     return(TargetedValueInterface.Get <T>(targeted));
 }
 public static void SetTargetedInterface(ITargetedBind targeted, IValueInterface <T> valueInterface)
 {
     TargetedValueInterface.Set(targeted, valueInterface);
 }
Esempio n. 5
0
 public static void SetTargetedInterface(long targetedId, IValueInterface <T> valueInterface)
 {
     TargetedValueInterface.Set(targetedId, valueInterface);
 }