Пример #1
0
        public override async Task <object> ReadFromAsync(DbDataReader rs, ICollectionPersister role, ICollectionAliases descriptor, object owner, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var element = (T)await(role.ReadElementAsync(rs, owner, descriptor.SuffixedElementAliases, Session, cancellationToken)).ConfigureAwait(false);
            int index   = (int)await(role.ReadIndexAsync(rs, descriptor.SuffixedIndexAliases, Session, cancellationToken)).ConfigureAwait(false);

            //pad with nulls from the current last element up to the new index
            for (int i = WrappedList.Count; i <= index; i++)
            {
                WrappedList.Insert(i, DefaultForType);
            }

            WrappedList[index] = element;
            return(element);
        }