Esempio n. 1
0
        public void TryInstallDemoContent()
        {
            if (session.Query <NoteWithCategories>().Any())
            {
                return;
            }

            var newNotes = DemoContent.GetNodesWithCategories("Redis", () => null);

            foreach (var newNote in newNotes)
            {
                session.Store(newNote);
            }

            session.SaveChanges();

            var newCategories = DemoContent.GetCategories(() => null);

            foreach (var newCategory in newCategories)
            {
                session.Store(newCategory);
            }

            session.SaveChanges();
        }
Esempio n. 2
0
        public void TryInstallDemoContent()
        {
            if (notes.Count() > 0)
            {
                return;
            }

            var newNotes = DemoContent.GetNodesWithCategories("MongoDB", () => null);

            notes.InsertBatch(newNotes);

            var newCategories = DemoContent.GetCategories(() => null);

            categories.InsertBatch(newCategories);
        }
Esempio n. 3
0
        public void TryInstallDemoContent()
        {
            using (var notes = redisClient.GetTypedClient <NoteWithCategories>())
            {
                if (redisClient.ContainsKey("urn:notewithcategories:1"))
                {
                    return;
                }

                var newNotes = DemoContent.GetNodesWithCategories("Redis", () => notes.GetNextSequence().AsString());
                notes.StoreAll(newNotes);
            }

            using (var categories = redisClient.GetTypedClient <Category>())
            {
                var newCategories = DemoContent.GetCategories(() => categories.GetNextSequence().AsString());
                categories.StoreAll(newCategories);
            }
        }