Пример #1
0
 /// <summary>
 /// Installs event handlers from the specified assembly.
 /// </summary>
 /// <param name="assembly">Assembly with event handlers.</param>
 /// <param name="mode">In memory or server mode.</param>
 /// <returns>Event store installer for Castle Windsor.</returns>
 /// <exception cref="ArgumentNullException"></exception>
 public static EventStoreInstaller FromAssembly(Assembly assembly, DocumentStoreMode mode)
 {
     if (assembly == null)
     {
         throw new ArgumentNullException(nameof(assembly));
     }
     return(new EventStoreInstaller(assembly.GetTypes(), mode));
 }
Пример #2
0
 private EventStoreInstaller(
     Tenant[] tenants,
     IEnumerable <Type> handlerTypes,
     DocumentStoreMode mode)
 {
     this.tenants      = tenants;
     this.handlerTypes = handlerTypes;
     this.mode         = mode;
 }
Пример #3
0
 public RavenInstaller(Tenant[] tenants)
 {
     mode = MvcApplication.Mode switch
     {
         ApplicationMode.Debug => DocumentStoreMode.Server,
         ApplicationMode.Release => DocumentStoreMode.Server,
         ApplicationMode.Test => DocumentStoreMode.InMemory,
         _ => throw new ArgumentOutOfRangeException(),
     };
     this.tenants = tenants;
 }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the RavenInstaller class.
        /// Raven mode is determined depending on debug or release:
        /// run with server when debugging, and embedded in production.
        /// </summary>
        public RavenInstaller()
        {
            switch (MvcApplication.Mode)
            {
                case ApplicationMode.Debug:
                    mode = DocumentStoreMode.Server;
                    break;

                case ApplicationMode.Release:
                    mode = DocumentStoreMode.Embeddable;
                    break;

                case ApplicationMode.Test:
                    mode = DocumentStoreMode.InMemory;
                    break;
            }
        }
Пример #5
0
 public RavenInstaller(Tenant[] tenants, DocumentStoreMode mode)
 {
     this.tenants = tenants;
     this.mode    = mode;
 }
Пример #6
0
 private EventStoreInstaller(IEnumerable <Type> handlerTypes, DocumentStoreMode mode)
 {
     this.handlerTypes = handlerTypes ?? throw new ArgumentNullException(nameof(handlerTypes));
     this.mode         = mode;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the RavenInstaller class.
 /// </summary>
 /// <param name="mode">Indicates which mode Raven will be run in.</param>
 public RavenInstaller(DocumentStoreMode mode)
 {
     this.mode = mode;
 }
Пример #8
0
 public static EventStoreInstaller FromAssembly(Tenant[] tenants, Assembly assembly, DocumentStoreMode mode)
 {
     return(assembly == null
         ? throw new ArgumentNullException(nameof(assembly))
         : new EventStoreInstaller(tenants, assembly.GetTypes(), mode));
 }