public TBuilder SetId <T>(IIdCollection <T> idCollection)
        {
            Contract.Requires(idCollection != null);

            var detail = InfrastructureErrorStrings.DocumentBuildExceptionDetailBuildResourceWithCollectionOfObjects
                         .FormatWith(DomNodeType.Id, typeof(TResource).Name);

            throw new DocumentBuildException(detail);
        }
Esempio n. 2
0
        public TBuilder SetId <T>(IIdCollection <T> idCollection)
        {
            Contract.Requires(idCollection != null);

            if (this.NotBuildingResourceIdentifier)
            {
                return(this.Builder);
            }

            var detail = InfrastructureErrorStrings.DocumentBuildExceptionDetailBuildResourceWithCollectionOfObjects
                         .FormatWith(DomNodeType.Id, this.ClrResourceType.Name);

            throw new DocumentBuildException(detail);
        }
Esempio n. 3
0
        public TBuilder SetId <T>(IIdCollection <T> idCollection)
        {
            Contract.Requires(idCollection != null);

            if (this.NotBuildingResourceIdentifierCollection)
            {
                return(this.Builder);
            }

            var clrIdCollection                = idCollection.ClrIdCollection;
            var clrResourceIdReadOnlyList      = clrIdCollection.SafeToReadOnlyList();
            var clrResourceIdReadOnlyListCount = clrResourceIdReadOnlyList.Count;

            this.CreateAndAddDomReadWriteResourceIdentifierCollectionIfNeeded(clrResourceIdReadOnlyListCount);

            var domReadWriteResourceIdentifierCollectionCount = this.DomReadWriteResourceIdentifierCollection.Count;

            if (clrResourceIdReadOnlyListCount != domReadWriteResourceIdentifierCollectionCount)
            {
                var detail = InfrastructureErrorStrings.DocumentBuildExceptionDetailBuildResourceCollectionCountMismatch
                             .FormatWith(DomNodeType.Id, domReadWriteResourceIdentifierCollectionCount, this.ClrResourceType.Name, clrResourceIdReadOnlyListCount);
                throw new DocumentBuildException(detail);
            }

            var count = domReadWriteResourceIdentifierCollectionCount;

            for (var i = 0; i < count; ++i)
            {
                var domReadWriteResourceIdentifier = this.DomReadWriteResourceIdentifierCollection[i];

                var clrResourceId = clrResourceIdReadOnlyList[i];
                domReadWriteResourceIdentifier.SetDomIdFromClrResourceId(this.ResourceType, clrResourceId);

                if (this.ResourceIdentifierMeta == null)
                {
                    continue;
                }

                var meta = this.ResourceIdentifierMeta;
                domReadWriteResourceIdentifier.SetDomReadOnlyMeta(meta);
            }

            return(this.Builder);
        }
Esempio n. 4
0
 public IdCollectionView(IIdCollection <S> source)
 {
     Source = source;
 }