private EmbeddableDocumentStore InitializeDocumentStore(UniqueConstraintsStoreListener listener, int port = 8079) { var documentStore = NewDocumentStore(port: port, configureStore: store => { store.Configuration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(UniqueConstraintsPutTrigger).Assembly)); store.RegisterListener(listener); }); return documentStore; }
private EmbeddableDocumentStore InitializeDocumentStore(UniqueConstraintsStoreListener listener, int port = 8079) { EmbeddableDocumentStore documentStore = new EmbeddableDocumentStore { RunInMemory = true, UseEmbeddedHttpServer = true, Configuration = { Port = port } }; documentStore.Configuration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(UniqueConstraintsPutTrigger).Assembly)); documentStore.RegisterListener(listener); documentStore.Initialize(); return documentStore; }
private static UniqueConstraintsTypeDictionary InternalFindDictionary(DocumentStoreBase store) { if (store != null) { try { UniqueConstraintsStoreListener listener = store.RegisteredStoreListeners.OfType <UniqueConstraintsStoreListener>().SingleOrDefault(); if (listener != null) { return(listener.UniqueConstraintsTypeDictionary); } } catch (InvalidOperationException) { // Multiple dictionaries found; this should never happen. } } return(null); }