/// <summary>
        /// Configures the storage with the user supplied persistence configuration
        /// DB schema is updated if requested by the user
        /// </summary>
        /// <param name="config">The <see cref="Configure" /> object.</param>
        /// <param name="configuration">The <see cref="Configuration" /> allows the application to specify properties and mapping documents to be used when creating a <see cref="ISessionFactory" />.</param>
        /// <returns>The <see cref="Configure" /> object.</returns>
        public static Configure UseNHibernateSubscriptionPersister(this Configure config, Configuration configuration)
        {
            foreach (var property in configuration.Properties)
            {
                ConfigureNHibernate.SubscriptionStorageProperties[property.Key] = property.Value;
            }

            return config.UseNHibernateSubscriptionPersisterInternal(configuration, true);
        }
        /// <summary>
        /// Configures the storage with the user supplied persistence configuration.
        /// Database schema is updated if requested by the user.
        /// </summary>
        /// <param name="config">The configuration object.</param>
        /// <param name="configuration">The <see cref="Configuration"/> object.</param>
        /// <param name="autoUpdateSchema"><value>true</value> to auto update schema</param>
        /// <returns>The configuration object</returns>
        public static Configure UseNHibernateTimeoutPersister(this Configure config, Configuration configuration, bool autoUpdateSchema)
        {
            foreach (var property in configuration.Properties)
            {
                ConfigureNHibernate.TimeoutPersisterProperties[property.Key] = property.Value;
            }

            return config.UseNHibernateTimeoutPersisterInternal(configuration, autoUpdateSchema);
        }
示例#3
0
        static void Main(string[] args)
        {
            var config = new Configuration();

            Console.WriteLine("Config before loading:\n{0}", DumpConfig(config));
            Console.WriteLine();
            ConfigLoader.Load(@"Deploy.config", config);

            Console.WriteLine("Config after loading:\n{0}", DumpConfig(config));
        }
示例#4
0
 private static string DumpConfig(Configuration config)
 {
     return string.Format("\tInstanceStringValue: {0}\n\tInstanceIntValue: {1}\n\tInstanceBoolValue: {2}\n\tCommentedOut: {3}\n\tStaticStringValue: {4}\n\tStaticIntValue: {5}\n\tStaticBoolValue: {6}",
                             config.InstanceStringValue,
                             config.InstanceIntValue,
                             config.InstanceBoolValue,
                             config.CommentedOut,
                             Configuration.StaticStringValue,
                             Configuration.StaticIntValue,
                             Configuration.StaticBoolValue);
 }
        static Configure UseNHibernateSubscriptionPersisterInternal(this Configure config, Configuration configuration, bool autoUpdateSchema)
        {
            ConfigureNHibernate.ThrowIfRequiredPropertiesAreMissing(ConfigureNHibernate.SubscriptionStorageProperties);

            Unicast.Subscriptions.NHibernate.Installer.Installer.RunInstaller = autoUpdateSchema;

            ConfigureNHibernate.AddMappings<SubscriptionMap>(configuration);

            var sessionSource = new SubscriptionStorageSessionProvider(configuration.BuildSessionFactory());

            config.Configurer.RegisterSingleton<ISubscriptionStorageSessionProvider>(sessionSource);
            config.Configurer.ConfigureComponent<SubscriptionStorage>(DependencyLifecycle.InstancePerCall);

            return config;
        }
        public static Configure DBSubcriptionStorage(this Configure config, Configuration configuration, bool autoUpdateSchema)
        {
            foreach (var property in configuration.Properties)
            {
                ConfigureNHibernate.SubscriptionStorageProperties[property.Key] = property.Value;
            }

            return config.UseNHibernateSubscriptionPersisterInternal(configuration, autoUpdateSchema);
        }
        static Configure UseNHibernateTimeoutPersisterInternal(this Configure config, Configuration configuration, bool autoUpdateSchema)
        {
            ConfigureNHibernate.ThrowIfRequiredPropertiesAreMissing(ConfigureNHibernate.TimeoutPersisterProperties);

            TimeoutPersisters.NHibernate.Installer.Installer.RunInstaller = autoUpdateSchema;
            ConfigureNHibernate.AddMappings<TimeoutEntityMap>(configuration);

            config.Configurer.ConfigureComponent<TimeoutStorage>(DependencyLifecycle.SingleInstance)
                .ConfigureProperty(p => p.SessionFactory, configuration.BuildSessionFactory());

            return config;
        }
示例#8
0
 public FrmOption(Configuration config) {
     InitializeComponent();
     this._config = config;
 }
        static Configure UseNHibernateSagaPersisterInternal(this Configure config, Configuration configuration, bool autoUpdateSchema)
        {
            ConfigureNHibernate.ThrowIfRequiredPropertiesAreMissing(ConfigureNHibernate.SagaPersisterProperties);

            SagaPersisters.NHibernate.Config.Installer.Installer.RunInstaller = autoUpdateSchema;

            var builder = new SessionFactoryBuilder(Configure.TypesToScan);

            var sessionFactory = builder.Build(configuration);

            if (sessionFactory == null)
            {
                throw new InvalidOperationException("Could not create session factory for saga persistence.");
            }

            config.Configurer.ConfigureComponent<UnitOfWorkManager>(DependencyLifecycle.SingleInstance)
                .ConfigureProperty(p => p.SessionFactory, sessionFactory);

            config.Configurer.ConfigureComponent<SagaPersister>(DependencyLifecycle.InstancePerCall);

            return config;
        }