public async System.Threading.Tasks.Task <DocumentDbTests.Metadata.MyTrackedDoc> ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
        {
            DocumentDbTests.Metadata.MyTrackedDoc document;
            document = await _serializer.FromJsonAsync <DocumentDbTests.Metadata.MyTrackedDoc>(reader, 0, token).ConfigureAwait(false);

            if (!(await reader.IsDBNullAsync(1, token).ConfigureAwait(false)))
            {
                var correlationId = await reader.GetFieldValueAsync <string>(1, token).ConfigureAwait(false);

                document.CorrelationId = correlationId;
            }
            if (!(await reader.IsDBNullAsync(2, token).ConfigureAwait(false)))
            {
                var causationId = await reader.GetFieldValueAsync <string>(2, token).ConfigureAwait(false);

                document.CausationId = causationId;
            }
            if (!(await reader.IsDBNullAsync(3, token).ConfigureAwait(false)))
            {
                var lastModifiedBy = await reader.GetFieldValueAsync <string>(3, token).ConfigureAwait(false);

                document.LastModifiedBy = lastModifiedBy;
            }
            return(document);
        }
        public async System.Threading.Tasks.Task <DocumentDbTests.Metadata.MyTrackedDoc> ResolveAsync(System.Data.Common.DbDataReader reader, System.Threading.CancellationToken token)
        {
            var id = await reader.GetFieldValueAsync <System.Guid>(0, token);

            if (_identityMap.TryGetValue(id, out var existing))
            {
                return(existing);
            }

            DocumentDbTests.Metadata.MyTrackedDoc document;
            document = await _serializer.FromJsonAsync <DocumentDbTests.Metadata.MyTrackedDoc>(reader, 1, token).ConfigureAwait(false);

            if (!(await reader.IsDBNullAsync(2, token).ConfigureAwait(false)))
            {
                var correlationId = await reader.GetFieldValueAsync <string>(2, token).ConfigureAwait(false);

                document.CorrelationId = correlationId;
            }
            if (!(await reader.IsDBNullAsync(3, token).ConfigureAwait(false)))
            {
                var causationId = await reader.GetFieldValueAsync <string>(3, token).ConfigureAwait(false);

                document.CausationId = causationId;
            }
            if (!(await reader.IsDBNullAsync(4, token).ConfigureAwait(false)))
            {
                var lastModifiedBy = await reader.GetFieldValueAsync <string>(4, token).ConfigureAwait(false);

                document.LastModifiedBy = lastModifiedBy;
            }
            _session.MarkAsDocumentLoaded(id, document);
            _identityMap[id] = document;
            StoreTracker(_session, document);
            return(document);
        }
Exemple #3
0
        public override async System.Threading.Tasks.Task ApplyReaderDataToEventAsync(System.Data.Common.DbDataReader reader, Marten.Events.IEvent e, System.Threading.CancellationToken token)
        {
            if (!(await reader.IsDBNullAsync(3, token).ConfigureAwait(false)))
            {
                var sequence = await reader.GetFieldValueAsync <long>(3, token).ConfigureAwait(false);

                e.Sequence = sequence;
            }
            if (!(await reader.IsDBNullAsync(4, token).ConfigureAwait(false)))
            {
                var id = await reader.GetFieldValueAsync <System.Guid>(4, token).ConfigureAwait(false);

                e.Id = id;
            }
            var streamId = await reader.GetFieldValueAsync <System.Guid>(5, token).ConfigureAwait(false);

            e.StreamId = streamId;
            if (!(await reader.IsDBNullAsync(6, token).ConfigureAwait(false)))
            {
                var version = await reader.GetFieldValueAsync <long>(6, token).ConfigureAwait(false);

                e.Version = version;
            }
            if (!(await reader.IsDBNullAsync(7, token).ConfigureAwait(false)))
            {
                var timestamp = await reader.GetFieldValueAsync <System.DateTimeOffset>(7, token).ConfigureAwait(false);

                e.Timestamp = timestamp;
            }
            if (!(await reader.IsDBNullAsync(8, token).ConfigureAwait(false)))
            {
                var tenantId = await reader.GetFieldValueAsync <string>(8, token).ConfigureAwait(false);

                e.TenantId = tenantId;
            }
            var isArchived = await reader.GetFieldValueAsync <bool>(9, token).ConfigureAwait(false);

            e.IsArchived = isArchived;
        }