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);
    }
Exemple #2
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);
            }
        }
    }
        public void TestAdd()
        {
            var set1 = AttributeSetFixture("add");

            _repository.Add(set1);

            Assert.Equal(set1, _repository.AttributeSetOf("add"));
        }