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

            AddDuringInitialize(index, element);
            return(element);
        }
        public override async Task <object> ReadFromAsync(DbDataReader rs, ICollectionPersister role, ICollectionAliases descriptor, object owner, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            object element = await(role.ReadElementAsync(rs, owner, descriptor.SuffixedElementAliases, Session, cancellationToken)).ConfigureAwait(false);
            int    index   = (int)await(role.ReadIndexAsync(rs, descriptor.SuffixedIndexAliases, Session, cancellationToken)).ConfigureAwait(false);

            for (int i = tempList.Count; i <= index; i++)
            {
                tempList.Add(null);
            }
            tempList[index] = element;
            return(element);
        }
Beispiel #3
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);
        }