For() public static method

public static For ( Action configure ) : IDocumentStore
configure Action
return IDocumentStore
Example #1
0
        public MartenRegistryTests()
        {
            var storeOptions = new StoreOptions();

            storeOptions.Schema.Include <TestRegistry>();

            var store = TestingDocumentStore.For(_ => _.Schema.Include <TestRegistry>());

            theStorage = store.Storage;
        }
Example #2
0
 protected void StoreOptions(Action <StoreOptions> configure)
 {
     _store = new Lazy <IDocumentStore>(() => TestingDocumentStore.For(_ =>
     {
         if (EnableCommandLogging)
         {
             _.Logger(new TestOutputMartenLogger(_output));
         }
         configure(_);
     }));
 }
Example #3
0
 public void fetch_index_definitions()
 {
     using (var store = TestingDocumentStore.For(_ =>
     {
         _.Schema.For <User>().Duplicate(x => x.UserName);
     }))
     {
         store.BulkInsert(new User[] { new User {
                                           UserName = "******"
                                       }, new User {
                                           UserName = "******"
                                       }, });
     }
 }
        public void persist_and_reload_a_document_using_buffers()
        {
            var user = new User {
                FirstName = "James", LastName = "Worthy"
            };

            using (var store = TestingDocumentStore.For(_ => { _.UseCharBufferPooling = true; }))
            {
                using (var session1 = store.OpenSession())
                {
                    session1.Store(user);
                    session1.SaveChanges();
                }

                using (var session2 = store.OpenSession())
                {
                    var user2 = session2.Load <User>(user.Id);

                    user.ShouldNotBeSameAs(user2);
                    user2.FirstName.ShouldBe(user.FirstName);
                    user2.LastName.ShouldBe(user.LastName);
                }
            }
        }
        public async Task persist_and_reload_a_document_async_using_buffers()
        {
            var user = new User {
                FirstName = "James", LastName = "Worthy"
            };

            using (var store = TestingDocumentStore.For(_ => { _.UseCharBufferPooling = true; }))
            {
                using (var session1 = store.OpenSession())
                {
                    session1.Store(user);
                    await session1.SaveChangesAsync().ConfigureAwait(false);
                }

                using (var session2 = store.OpenSession())
                {
                    var user2 = await session2.LoadAsync <User>(user.Id).ConfigureAwait(false);

                    user.ShouldNotBeSameAs(user2);
                    user2.FirstName.ShouldBe(user.FirstName);
                    user2.LastName.ShouldBe(user.LastName);
                }
            }
        }
Example #6
0
 protected void StoreOptions(Action <StoreOptions> configure)
 {
     _store = new Lazy <IDocumentStore>(() => TestingDocumentStore.For(configure));
 }