Пример #1
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);
                }
            }
        }