CreateSession() public method

public CreateSession ( ) : ISession
return ISession
        /// <summary>
        /// Configures the storage with the user supplied persistence configuration
        /// Azure tables are created if requested by the user
        /// </summary>
        /// <param name="config"></param>
        /// <param name="connectionString"></param>
        /// <param name="createSchema"></param>
        /// <returns></returns>
        public static Configure AzureSubcriptionStorage(this Configure config,
            string connectionString,
            bool createSchema)
        {
            var database = MsSqlConfiguration.MsSql2005
                .ConnectionString(connectionString)
                .Provider(typeof(TableStorageConnectionProvider).AssemblyQualifiedName)
                .Dialect(typeof(TableStorageDialect).AssemblyQualifiedName)
                .Driver(typeof(TableStorageDriver).AssemblyQualifiedName)
                .ProxyFactoryFactory(typeof(ProxyFactoryFactory).AssemblyQualifiedName);

            var fluentConfiguration = Fluently.Configure()
                .Database(database)
                .Mappings(m => m.FluentMappings.Add(typeof (SubscriptionMap)));
            var configuration = fluentConfiguration.BuildConfiguration();

            var sessionSource = new SessionSource(fluentConfiguration);

            if (createSchema)
            {
                using (var session = sessionSource.CreateSession())
                {
                    new SchemaExport(configuration).Execute(true, true, false, session.Connection, null);
                    session.Flush();
                }
            }

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

            return config;
        }
Esempio n. 2
0
 protected virtual void Before_each_test()
 {
     SessionSource = new SessionSource(new TestModel());
     Session = SessionSource.CreateSession();
     SessionSource.BuildSchema(Session);
     CreateInitialData(Session);
     Session.Clear();
 }
Esempio n. 3
0
        public void SetupContext()
        {
            var cfg = Fluently.Configure().Database(SQLiteConfiguration.Standard.InMemory);

            SessionSource = new SessionSource(cfg.BuildConfiguration().Properties, new TestModel());
            Session = SessionSource.CreateSession();
            SessionSource.BuildSchema(Session);
        }
 public void AutoCriarBancoDeDados()
 {
     if (_fluentConfiguration != null)
     {
         var sessionSource = new SessionSource(_fluentConfiguration);
         ISession session = sessionSource.CreateSession();
         sessionSource.BuildSchema(session);
     }
 }
 protected virtual void Context()
 {
     SessionSource = new SessionSource(new TestModel());
     Session = SessionSource.CreateSession();
     SessionSource.BuildSchema(Session);
     CreateInitialData(Session);
     Session.Flush();
     Session.Clear();
 }
        public void SetUp()
        {
            FluentConfiguration config = Fluently
                .Configure()
                .Database(SQLiteConfiguration.Standard.InMemory().ShowSql())
                .Mappings(
                    m =>
                        {
                            m.FluentMappings.AddFromAssemblyOf<Vehicle>();
                            m.AutoMappings.Add(
                                AutoMap
                                    .AssemblyOf<Plant>()
                                    .Where(x => x.Namespace == "Fluent.Entities"));
                        });

            _sessionSource = new SessionSource(config);
            _session = _sessionSource.CreateSession();
            _sessionSource.BuildSchema(_session);
        }
Esempio n. 7
0
 private static void BuildSchema(FluentConfiguration configuration)
 {
     var sessionSource = new SessionSource(configuration);
     var session = sessionSource.CreateSession();
     sessionSource.BuildSchema(session);
 }