Beispiel #1
0
            internal static TargetLedger Create(CompoundStateLedger owner, Component target, string memberName)
            {
                if (target == null || string.IsNullOrEmpty(memberName))
                {
                    return(null);
                }

                var member = DynamicUtil.GetMember(target, memberName, true);

                if (member == null)
                {
                    return(null);
                }

                var entry = new TargetLedger();

                entry._owner      = owner;
                entry._target     = target;
                entry._memberName = memberName;
                entry._accessor   = new DynamicMemberAccessor(memberName);
                entry.ReinitBaseValue();
                return(entry);
            }
Beispiel #2
0
            public void Dispose()
            {
                _entries.Clear();
                if (_accessor != null)
                {
                    _accessor.Set(_target, _baseValue);
                }
                if (_owner != null)
                {
                    var          token = new Token(_target, _memberName);
                    TargetLedger obj;
                    if (_owner._table.TryGetValue(token, out obj) && obj == this)
                    {
                        _owner._table.Remove(token);
                    }
                }

                _owner      = null;
                _target     = null;
                _memberName = null;
                _accessor   = null;
                _baseValue  = 0d;
                _baseValue  = 0d;
            }