Beispiel #1
0
        private static void StoreProduct(IDocumentSession session, string name, decimal price)
        {
            var product = new Product
            {
                Name = name,
                Price = price
            };

            session.Store(product);
            session.SaveChanges();
        }
Beispiel #2
0
        private static void CreateProduct(string name, decimal price)
        {
            var documentStore = new DocumentStore { Url = "http://asus:8081/" };
            documentStore.Initialize();

            using (var session = documentStore.OpenSession())
            {
                var product = new Product
                {
                    Name = name,
                    Price = price
                };

                session.Store(product);
                session.SaveChanges();
            }
        }
Beispiel #3
0
        public void TestStoreProduct()
        {
            var documentStore = new EmbeddableDocumentStore { RunInMemory = true };
            documentStore.Initialize();

            using (var session = documentStore.OpenSession())
            {
                var product = new Product
                {
                    Name = "Test product",
                    Price = 1m
                };

                session.Store(product);
                session.SaveChanges();
            }
        }
Beispiel #4
0
        public static void CreateProduct(IAsyncDocumentSession session, string name, decimal price)
        {
            var entity = new Product { Name = name, Price = price };

            session.Store(entity);
        }