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 FlowerStore(IDocumentDbAccessProvider dbAccessProvider) : base(dbAccessProvider, false)
            {
                var config = new DocumentStoreConfigBuilder("Flowers");

                var documentType = config.AddDocument("Daisy").Finish();

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

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

                DbAccess.ConfigRegistry.RegisterStoreConfigSource(this);
            }
Пример #3
0
        public OrderStore(
            IDocumentDbAccessProvider dbAccessProvider,
            IDocumentMetadataSource metadataSource) : base(dbAccessProvider)
        {
            var config = new DocumentStoreConfigBuilder("Orders");

            var orderDocumentType = config.AddDocument("Order").Finish();

            _orderMapping = config.AddDocumentMapping <Order>(orderDocumentType.DocumentName)
                            .SetIdMapper(x => x.Id.ToString())
                            .SetPartitionMapper(x => x.Id.ToString())
                            .Finish();

            _config = config.Finish();
            _client = CreateStoreLogic(DbAccess, _config, metadataSource);
        }
            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);
            }
Пример #5
0
        public FlowerStore(
            IDocumentDbAccessProvider dbAccessProvider,
            IDocumentMetadataSource metadataSource) : base(dbAccessProvider, false)
        {
            var config = new DocumentStoreConfigBuilder("Flowers");

            var daisyDocumentType = config.AddDocument("Daisy").Finish();
            var roseDocumentType  = config.AddDocument("Rose").Finish();

            _daisyMapping = config.AddDocumentMapping <Daisy>(daisyDocumentType.DocumentName)
                            .SetIdMapper(x => x.Id.ToString())
                            .SetPartitionMapper(x => x.Id.ToString())
                            .Finish();

            _gardenMapping = config.AddDocumentMapping <Garden>(roseDocumentType.DocumentName)
                             .SetIdMapper(x => x.Id.ToString())
                             .SetPartitionMapper(x => x.Id.ToString())
                             .Finish();

            _config = config.Finish();
            _client = CreateStoreLogic(DbAccess, _config, metadataSource);
        }
            public FruitStore(IDocumentDbAccessProvider dbAccessProvider, IDocumentMetadataSource metadataSource)
                : base(dbAccessProvider, false)
            {
                var config = new DocumentStoreConfigBuilder("Fruit");

                var appleDocumentType = config.AddDocument("Apple").Finish();
                var pearDocumentType  = config.AddDocument("Pear").Finish();

                _appleMapping = config.AddDocumentMapping <Apple>(appleDocumentType.DocumentName)
                                .SetIdMapper(x => x.Id.ToString())
                                .SetPartitionMapper(x => x.Id.ToString())
                                .Finish();

                _pearMapping = config.AddDocumentMapping <Pear>(pearDocumentType.DocumentName)
                               .SetIdMapper(x => x.Id.ToString())
                               .SetPartitionMapper(x => x.Id.ToString())
                               .Finish();

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

                DbAccess.ConfigRegistry.RegisterStoreConfigSource(this);
            }