Esempio n. 1
0
		public virtual IDocumentStore CreateStore(RavenConnectionProvider connections)
		{
			var store = RunInMemory
				? new EmbeddableDocumentStore { RunInMemory = RunInMemory }
				: EmbeddedDocumentStore 
					? new EmbeddableDocumentStore { ConnectionStringName = connectionStringName }
					: new DocumentStore { ConnectionStringName = connectionStringName };

			Initialize(connections, store);

			return store;
		}
Esempio n. 2
0
        public virtual IDocumentStore CreateStore(RavenConnectionProvider connections)
        {
            var store = RunInMemory
                                ? new EmbeddableDocumentStore {
                RunInMemory = RunInMemory
            }
                                : EmbeddedDocumentStore
                                        ? new EmbeddableDocumentStore {
                ConnectionStringName = connectionStringName
            }
                                        : new DocumentStore {
                ConnectionStringName = connectionStringName
            };

            Initialize(connections, store);

            return(store);
        }
Esempio n. 3
0
 protected virtual void Initialize(RavenConnectionProvider connections, DocumentStore store)
 {
     store.Conventions.MaxNumberOfRequestsPerSession = 100;
     store.Conventions.FindIdentityProperty          = pi => pi.Name == "ID";
     store.Conventions.JsonContractResolver          = new ContentContractResolver();
     store.Conventions.FindTypeTagName         = t => typeof(ContentItem).IsAssignableFrom(t) ? "ContentItem" : null;
     store.Conventions.SaveEnumsAsIntegers     = true;
     store.Conventions.CustomizeJsonSerializer = (serializer) =>
     {
         serializer.ReferenceLoopHandling      = ReferenceLoopHandling.Ignore;
         serializer.PreserveReferencesHandling = PreserveReferencesHandling.All;
         serializer.ReferenceResolver          = new ContentReferenceResolver(connections);
         serializer.Converters.Add(new DetailsJsonConverter());
         serializer.Converters.Add(new DetailCollectionsJsonConverter());
         serializer.TypeNameHandling = TypeNameHandling.All;
     };
     store.RegisterListener((IDocumentConversionListener) new Listener());
     store.RegisterListener((IDocumentDeleteListener) new Listener());
     store.RegisterListener((IDocumentQueryListener) new Listener());
     store.RegisterListener((IDocumentStoreListener) new Listener());
     store.Initialize();
 }
Esempio n. 4
0
		protected virtual void Initialize(RavenConnectionProvider connections, DocumentStore store)
		{
			store.Conventions.MaxNumberOfRequestsPerSession = 100;
			store.Conventions.FindIdentityProperty = pi => pi.Name == "ID";
			store.Conventions.JsonContractResolver = new ContentContractResolver();
			store.Conventions.FindTypeTagName = t => typeof(ContentItem).IsAssignableFrom(t) ? "ContentItem" : null;
			store.Conventions.SaveEnumsAsIntegers = true;
			store.Conventions.CustomizeJsonSerializer = (serializer) =>
			{
				serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
				serializer.PreserveReferencesHandling = PreserveReferencesHandling.All;
				serializer.ReferenceResolver = new ContentReferenceResolver(connections);
				serializer.Converters.Add(new DetailsJsonConverter());
				serializer.Converters.Add(new DetailCollectionsJsonConverter());
				serializer.TypeNameHandling = TypeNameHandling.All;
			};
			store.RegisterListener((IDocumentConversionListener)new Listener());
			store.RegisterListener((IDocumentDeleteListener)new Listener());
			store.RegisterListener((IDocumentQueryListener)new Listener());
			store.RegisterListener((IDocumentStoreListener)new Listener());
			store.Initialize();
		}
Esempio n. 5
0
		public ContentReferenceResolver(RavenConnectionProvider connections)
		{
			this.connections = connections;
		}
Esempio n. 6
0
		public RavenInstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config, RavenConnectionProvider cp)
			: base(connectionContext, importer, webContext, persister, activator)
		{
			this.cp = cp;
		}
Esempio n. 7
0
 public RavenRepository(RavenConnectionProvider connection)
 {
     this.connection = connection;
 }
Esempio n. 8
0
 public RavenContentRepository(RavenConnectionProvider connections)
     : base(connections)
 {
     this.connections = connections;
 }
Esempio n. 9
0
 public ContentReferenceResolver(RavenConnectionProvider connections)
 {
     this.connections = connections;
 }
Esempio n. 10
0
 public RavenInstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config, RavenConnectionProvider cp)
     : base(connectionContext, importer, webContext, persister, activator)
 {
     this.cp = cp;
 }