public FluentNHibernateJobStorage(SessionFactoryInfo info) { ProviderType = info.ProviderType; _sessionFactory = info.SessionFactory; var tmp = info.Options as FluentNHibernateStorageOptions; Options = tmp ?? new FluentNHibernateStorageOptions(); InitializeQueueProviders(); _expirationManager = new ExpirationManager(this, Options.JobExpirationCheckInterval); _countersAggregator = new CountersAggregator(this, Options.CountersAggregateInterval); _serverTimeSyncManager = new ServerTimeSyncManager(this, TimeSpan.FromMinutes(5)); //escalate session factory issues early try { EnsureDualHasOneRow(); RefreshUtcOffset(); } catch (FluentConfigurationException ex) { throw ex.InnerException ?? ex; } }
public FluentNHibernateJobStorage(SessionFactoryInfo info) { SessionFactoryInfo = info; ClassMetadataDictionary = info.SessionFactory.GetAllClassMetadata(); ProviderType = info.ProviderType; _sessionFactory = info.SessionFactory; var tmp = info.Options as FluentNHibernateStorageOptions; Options = tmp ?? new FluentNHibernateStorageOptions(); InitializeQueueProviders(); _expirationManager = new ExpirationManager(this); _countersAggregator = new CountersAggregator(this); _serverTimeSyncManager = new ServerTimeSyncManager(this); //escalate session factory issues early try { EnsureDualHasOneRow(); } catch (FluentConfigurationException ex) { throw ex.InnerException ?? ex; } }
protected RepositoryBase(ProviderTypeEnum providerType, string nameOrConnectionString, FluentNHibernatePersistenceBuilderOptions options) { _info = SessionFactoryBuilder.GetFromAssemblyOf <AspNetUser>(providerType, nameOrConnectionString, options); }
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); }
public FluentNHibernateQueue(string name, SessionFactoryInfo info, LocalOptions <T> opts = null) { Info = info; LocalOptions = opts ?? new LocalOptions <T>(); using (var session = GetStatelessSession()) { var sqlConnection = session.Connection as SqlConnection; if (sqlConnection != null) { var rx = new Regex("^\\d\\."); if (rx.IsMatch(sqlConnection.ServerVersion)) { var dt = Convert.ToDateTime(session.CreateSQLQuery("select getutcdate()").UniqueResult()); _dateOffset = dt.Subtract(DateTime.UtcNow); } else { var dt = Convert.ToDateTime(session.CreateSQLQuery("select sysutcdatetime()").UniqueResult()); _dateOffset = dt.Subtract(DateTime.UtcNow); } } using (var tx = session.BeginTransaction()) { _myQueue = session.Query <Queue>().FirstOrDefault(i => i.Name == name); if (_myQueue == null) { _myQueue = new Queue { Name = name, CreateDateTime = DateNow() }; session.Insert(_myQueue); } tx.Commit(); } } }
protected internal RepositoryBase(string sessionFactoryKey) { _info = SessionFactoryBuilder.GetByKey(sessionFactoryKey); }