Exemple #1
0
        public void demonstration()
        {
            using (var store = DocumentStore.For(_ =>
            {
                _.DatabaseSchemaName = "setting_timestamp";
                _.Connection(ConnectionSource.ConnectionString);
                _.AutoCreateSchemaObjects = AutoCreate.All;
                _.Listeners.Add(new TimestampListener());
            }))
            {
                var doc1s = new Doc1[] { new Doc1(), new Doc1(), };
                var doc2s = new Doc2[] { new Doc2(), new Doc2(), };
                var doc3s = new Doc3[] { new Doc3(), new Doc3(), };

                using (var session = store.OpenSession())
                {
                    session.Store(doc1s);
                    session.Store(doc2s);
                    session.Store(doc3s);

                    session.SaveChanges();
                }

                doc1s.Each(x => x.Timestamp.ShouldNotBeNull());
                doc2s.Each(x => x.Timestamp.ShouldNotBeNull());
                doc3s.Each(x => x.Timestamp.ShouldNotBeNull());
            }
        }
        public void demonstration()
        {
            using (var store = DocumentStore.For(_ =>
            {
                _.Connection(ConnectionSource.ConnectionString);
                _.AutoCreateSchemaObjects = AutoCreate.All;
                _.Listeners.Add(new TimestampListener());
            }))
            {
                var doc1s = new Doc1[] {new Doc1(), new Doc1(), };
                var doc2s = new Doc2[] {new Doc2(), new Doc2(), };
                var doc3s = new Doc3[] {new Doc3(), new Doc3(), };

                using (var session = store.OpenSession())
                {
                    session.Store(doc1s);
                    session.Store(doc2s);
                    session.Store(doc3s);

                    session.SaveChanges();
                }

                doc1s.Each(x => x.Timestamp.ShouldNotBeNull());
                doc2s.Each(x => x.Timestamp.ShouldNotBeNull());
                doc3s.Each(x => x.Timestamp.ShouldNotBeNull());
            }
        }