Пример #1
0
        private void AddProducts()
        {
            CreateIndex();

            foreach (var product in GetProducts())
            {
                Console.WriteLine(
                    DocumentService.AddOrUpdate(IndexName, new Id(product.Id), product)
                    .DebugInformation
                    );
            }
        }
Пример #2
0
        public void UpdatingDocumentsExample()
        {
            CreateIndex();
            AddProducts();

            var product = DocumentService.GetById <Product>(IndexName, new Id(1)) ??
                          throw new ApplicationException("Продукт не найден.");

            SetNewValues(product);

            Console.WriteLine(
                DocumentService.AddOrUpdate(IndexName, new Id(product.Id), product)
                .DebugInformation
                );

            DeleteIndex();
        }