protected RepositoryBase(ProviderTypeEnum providerType, string nameOrConnectionString,
                          FluentNHibernatePersistenceBuilderOptions options)
 {
     _info =
         SessionFactoryBuilder.GetFromAssemblyOf <AspNetUser>(providerType,
                                                              nameOrConnectionString, options);
 }
Пример #2
0
        private void Initialize(object state)
        {
            try
            {
                var sessionFactoryInfo = SessionFactoryBuilder.GetFromAssemblyOf <Message0Map>(
                    _configuration.ProviderType, _configuration.ConnectionString,
                    new FluentNHibernatePersistenceBuilderOptions {
                    DefaultSchema = _configuration.DefaultSchema
                });
                var sessionFactory = sessionFactoryInfo.SessionFactory;
                // NOTE: Called from a ThreadPool thread
                _trace.TraceInformation("Message bus initializing.");

                while (true)
                {
                    try
                    {
                        var installer = new FNHInstaller(sessionFactory, _trace);
                        installer.Install();
                        break;
                    }
                    catch (Exception ex)
                    {
                        _trace.TraceError("Error trying to install database objects, trying again in 2 seconds: {0}",
                                          ex);

                        // Try again in a little bit
                        Thread.Sleep(2000);
                    }
                }

                var collection = new List <IStream>
                {
                    new FNHStream <Messages_0, Messages_0_Id>(0, sessionFactory, _trace),
                    new FNHStream <Messages_1, Messages_1_Id>(1, sessionFactory, _trace),
                    new FNHStream <Messages_2, Messages_2_Id>(2, sessionFactory, _trace),
                    new FNHStream <Messages_3, Messages_3_Id>(3, sessionFactory, _trace),
                    new FNHStream <Messages_4, Messages_4_Id>(4, sessionFactory, _trace),
                    new FNHStream <Messages_5, Messages_5_Id>(5, sessionFactory, _trace),
                    new FNHStream <Messages_6, Messages_6_Id>(6, sessionFactory, _trace),
                    new FNHStream <Messages_7, Messages_7_Id>(7, sessionFactory, _trace),
                    new FNHStream <Messages_8, Messages_8_Id>(8, sessionFactory, _trace),
                    new FNHStream <Messages_9, Messages_9_Id>(9, sessionFactory, _trace)
                };
                _streams.AddRange(collection.Take(_configuration.TableCount));
                foreach (var stream in _streams)
                {
                    stream.Queried  += () => Open(stream.StreamIndex);
                    stream.Faulted  += ex => OnError(stream.StreamIndex, ex);
                    stream.Received += (id, messages) => OnReceived(stream.StreamIndex, id, messages);
                    StartReceiving(stream);
                }
            }
            catch (Exception ex)
            {
                _trace.TraceError("Issue", ex);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="logger"></param>
        public FluentNHibernateMessageRepository(FNHScaleoutConfiguration configuration,
                                                 ILogger <FluentNHibernateMessageRepository> logger)
        {
            _configuration = configuration;
            var sessionFactoryInfo = SessionFactoryBuilder.GetFromAssemblyOf <MessagePayloadMap_0>(
                configuration.ProviderType, configuration.ConnectionString,
                new FluentNHibernatePersistenceBuilderOptions {
                DefaultSchema = configuration.DefaultSchema
            });

            _logger         = logger;
            _sessionFactory = sessionFactoryInfo.SessionFactory;
            for (var streamIndex = 0; streamIndex < configuration.StreamCount; streamIndex++)
            {
                _streamInfos[streamIndex] = new StreamInfo(streamIndex);
            }
        }
        public static void TestFixtureSetup(TestContext context)
        {
            _fileInfo         = new FileInfo(Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".sqlite"));
            _connectionString = string.Format("Data Source={0};Version=3;", _fileInfo.FullName);
            SQLiteConnection.CreateFile(_fileInfo.FullName);

            var persistenceConfigurer = FluentNHibernatePersistenceBuilder.GetPersistenceConfigurer(
                ProviderTypeEnum.SQLite,
                _connectionString,
                new FluentNHibernatePersistenceBuilderOptions());

            info = SessionFactoryBuilder.GetFromAssemblyOf <Dummy>(persistenceConfigurer,
                                                                   new FluentNHibernatePersistenceBuilderOptions {
                ObjectRenamer = new PrefixRenamer()
            });
            _sessionFactory = info.SessionFactory;

            var uu = UtcDateHelper.GetUtcNow(_sessionFactory, info.ProviderType);
        }
Пример #5
0
 public FluentNHibernateJobStorage(IPersistenceConfigurer persistenceConfigurer,
                                   FluentNHibernateStorageOptions options = null) : this(SessionFactoryBuilder.GetFromAssemblyOf <_CounterMap>(
                                                                                             persistenceConfigurer, options))
 {
 }
Пример #6
0
 public FluentNHibernateJobStorage(ProviderTypeEnum providerType, string nameOrConnectionString,
                                   FluentNHibernateStorageOptions options = null) : this(
         SessionFactoryBuilder.GetFromAssemblyOf <_CounterMap>(providerType, nameOrConnectionString, options))
 {
 }
 public FluentNHibernateQueue(string name, IPersistenceConfigurer configurer, bool buildSchema = false,
                              LocalOptions <T> opts = null) : this(name, SessionFactoryBuilder
                                                                   .GetFromAssemblyOf <QueueItemMap>(configurer,
                                                                                                     new FluentNHibernatePersistenceBuilderOptions { UpdateSchema = buildSchema }), opts)
 {
 }
 public FluentNHibernateQueue(string name, ProviderTypeEnum providerType, string nameOrConnectionString,
                              LocalOptions <T> opts = null, FluentNHibernatePersistenceBuilderOptions builderOptions = null) : this(name,
                                                                                                                                    SessionFactoryBuilder.GetFromAssemblyOf <QueueItemMap>(providerType, nameOrConnectionString, builderOptions))
 {
 }