Пример #1
0
    private static void BuildSchema(FluentConfiguration configuration)
    {
        var sessionSource = new SessionSource(configuration);
        var session       = sessionSource.CreateSession();

        sessionSource.BuildSchema(session);
    }
        public static ISession OpenTemporarySession()
        {
            lock (factorylock)
            {
                if (_sessionSource == null)
                {
                    var persistenceModel = new PersistenceModel();
                    persistenceModel.AddMappingsFromAssembly(typeof(JiraIssueMap).Assembly);

                    var sqLiteConfiguration = new SQLiteConfiguration()
                                              .InMemory()
                                              .ShowSql();

                    var sessionSource = new SessionSource(sqLiteConfiguration.ToProperties(), persistenceModel);

                    _sessionSource = sessionSource;
                }
            }

            var session = _sessionSource.CreateSession();

            _sessionSource.BuildSchema(session);

            return(session);
        }
        public void FixtureSetUp()
        {
            BootStrapper.Bootstrap();

            SessionSource = ObjectFactory.GetInstance <ISessionSource>();
            SessionSource.BuildSchema();
        }
Пример #4
0
 protected virtual void Before_each_test()
 {
     SessionSource = new SessionSource(new TestModel());
     Session       = SessionSource.CreateSession();
     SessionSource.BuildSchema(Session);
     CreateInitialData(Session);
     Session.Clear();
 }
        public void RecreateDb(ISession session)
        {
            InitSessionFactory();
            var sessionSource = new SessionSource(_fluentConfiguration);

            sessionSource.BuildSchema(session);
            session.Flush();
        }
 protected virtual void Context()
 {
     SessionSource = new SessionSource(new TModel());
     Session       = SessionSource.CreateSession();
     SessionSource.BuildSchema(Session);
     CreateInitialData(Session);
     Session.Flush();
     Session.Clear();
 }
 public void AutoCriarBancoDeDados()
 {
     if (_fluentConfiguration != null)
     {
         var      sessionSource = new SessionSource(_fluentConfiguration);
         ISession session       = sessionSource.CreateSession();
         sessionSource.BuildSchema(session);
     }
 }
Пример #8
0
        private void TestConnection(string connectionString)
        {
            SessionSource sessionSource = SqLiteConnector.CreateDebugSessionSource(connectionString);

            using (ISession session = sessionSource.CreateSession())
            {
                sessionSource.BuildSchema(session);
            }
        }
        public void SetupContext()
        {
            var cfg = new SQLiteConfiguration()
                      .InMemory()
                      .ShowSql();

            SessionSource = new SessionSource(cfg.ToProperties(), new TModel());
            Session       = SessionSource.CreateSession();
            SessionSource.BuildSchema(Session);

            Context();
            Session.Flush();
            Session.Clear();

            Because();
        }
Пример #10
0
        public NHibernateConfig()
        {
            var config = new SQLiteConfiguration()
                         .InMemory()
                         .ShowSql()
                         .Raw("hibernate.generate_statistics", "true");

            var nhConfig = Fluently.Configure()
                           .Database(config)
                           .Mappings(mappings =>
                                     mappings.FluentMappings.AddFromAssemblyOf <CustomerMap>()
                                     .Conventions.AddFromAssemblyOf <IdGenerationConvention>())
                           .ExposeConfiguration(x => new SchemaExport(x).Execute(true, true, false));

            var SessionSource = new SessionSource(nhConfig);

            Session = SessionSource.CreateSession();
            SessionSource.BuildSchema(Session);
        }