public LargeDocumentStore(IDocumentDbAccessProvider dbAccessProvider) : base(dbAccessProvider, false)
            {
                var config = new DocumentStoreConfigBuilder("LargeStore");

                var largeDocumentType = config.AddDocument("LargeDocument");

                var attachmentDocumentType = config.AddDocument("AttachmentDocument");
                var attachmentType         = attachmentDocumentType.AddAttachment("Attachment");

                _largeMapping = config.AddDocumentMapping <LargeDocument>(largeDocumentType.Name)
                                .SetIdMapper(x => x.Id.ToString())
                                .SetPartitionMapper(x => x.Id.ToString())
                                .Finish();

                _smallMapping = config.AddDocumentMapping <SmallDocumentWithLargeAttachment>(attachmentDocumentType.Name)
                                .SetIdMapper(x => x.Id.ToString())
                                .SetPartitionMapper(x => x.Id.ToString())
                                .Finish();

                _attachmentMapping = _smallMapping.AddAttachmentMapping <LargeDocument>(attachmentType.Name)
                                     .Finish();

                _config = config.Finish();
                _client = CreateStoreLogic(DbAccess, _config);

                DbAccess.ConfigRegistry.RegisterStoreConfigSource(this);
            }
        public Task CreateAttachmentAsync <TDocument, TAttachment>(
            TDocument document,
            int documentVersion,
            AttachmentTypeMapping <TDocument, TAttachment> attachmentMapping,
            TAttachment attachment)
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }
            if (attachmentMapping == null)
            {
                throw new ArgumentNullException(nameof(attachmentMapping));
            }
            if (attachment == null)
            {
                throw new ArgumentNullException(nameof(attachment));
            }

            var documentMapping = attachmentMapping.DocumentMapping;

            var documentId       = documentMapping.IdMapper(document);
            var documentRecordId = CreateRecordId(documentId, documentVersion, documentMapping);
            var partitionKey     = documentMapping.PartitionKeyMapper(document);

            return(CreateDocumentAttachmentAsync(documentRecordId, partitionKey, attachmentMapping, attachment));
        }
            public EmailStore(IDocumentDbAccessProvider dbAccessProvider) : base(dbAccessProvider, false)
            {
                var config = new DocumentStoreConfigBuilder("EmailClient");

                var documentType   = config.AddDocument("Email");
                var attachmentType = documentType.AddAttachment("EmailAttachment");

                _mapping = config.AddDocumentMapping <Email>(documentType.Name)
                           .SetIdMapper(x => x.Id.ToString())
                           .SetPartitionMapper(x => x.Id.ToString())
                           .Finish();

                _attachmentMapping = _mapping.AddAttachmentMapping <EmailAttachment>(attachmentType.Name)
                                     .Finish();

                _config = config.Finish();
                _client = CreateStoreLogic(DbAccess, _config);

                DbAccess.ConfigRegistry.RegisterStoreConfigSource(this);
            }