internal void AddAttribute(ReceivedAttributeMessage request)
        {
            var attributeSet = _repository.AttributeSetOf(request.AttributeSetName);

            if (attributeSet.IsNone)
            {
                attributeSet = AttributeSet.Named(request.AttributeSetName);
                _repository.Add(attributeSet);
            }
            var tracked = attributeSet.AddIfAbsent(request.Attribute());

            _confirmingDistributor.Confirm(request.TrackingId, attributeSet, tracked, request.Type, _configuration.NodeMatching(request.SourceNodeId));
        }
Пример #2
0
        public IEnumerable <Attribute> AllOf(string attributeSetName)
        {
            var all = new List <Attribute>();
            var set = _repository.AttributeSetOf(attributeSetName);

            if (set.IsDefined)
            {
                foreach (var tracked in set.All)
                {
                    if (tracked.IsPresent)
                    {
                        all.Add(tracked.Attribute);
                    }
                }
            }

            return(all);
        }
Пример #3
0
        //=========================================
        // AttributesAgent (core)
        //=========================================
        #region AttributesAgent (core)

        public void Add <T>(string attributeSetName, string attributeName, T value)
        {
            var set = _repository.AttributeSetOf(attributeSetName);

            if (set.IsNone)
            {
                var newSet = AttributeSet.Named(attributeSetName);
                newSet.AddIfAbsent(Attribute <T> .From(attributeName, value));
                _repository.Add(newSet);
                _client.SyncWith(newSet);
                _confirmingDistributor.DistributeCreate(newSet);
            }
            else
            {
                var newlyTracked = set.AddIfAbsent(Attribute <T> .From(attributeName, value));
                if (!newlyTracked.IsDistributed)
                {
                    _confirmingDistributor.Distribute(set, newlyTracked, ApplicationMessageType.AddAttribute);
                }
            }
        }