Пример #1
0
        /// <summary>
        /// Creates the database schema.
        /// </summary>
        /// <param name="nhibernateConfigurator">An instance of NHibernate configurator</param>
        /// <param name="connection">An opened connection</param>
        public void CreateDatabaseSchema(
            INhibernateConfigurator nhibernateConfigurator,
            DbConnection connection
            )
        {
            var configuration = nhibernateConfigurator.GetConfiguration();

            // We need to drop the schema twice due to this issue: https://stackoverflow.com/a/6536366/379279

            new SchemaExport(configuration).Execute(
                useStdOut: true,
                execute: true,
                justDrop: true, // just dropping the schema - not creating it
                connection: connection,
                exportOutput: null
                );

            new SchemaExport(configuration).Execute(
                useStdOut: true,
                execute: true,
                justDrop: false, // dropping the schema and creating it
                connection: connection,
                exportOutput: null
                );
        }
Пример #2
0
 /// <summary>
 /// Initialized the instance.
 /// </summary>
 /// <param name="databaseSchemaFileName">A file name with the generated SQL script</param>
 /// <param name="nhibernateConfigurator">An instance of NHibernate configurator</param>
 public DatabaseSchemaGenerator(
     string databaseSchemaFileName,
     INhibernateConfigurator nhibernateConfigurator
     )
 {
     _nhibernateConfigurator = nhibernateConfigurator;
     _databaseSchemaFileName = databaseSchemaFileName;
 }
Пример #3
0
 public NhibernateUnitOfWork(INhibernateConfigurator configurator)
 {
     _configurator = configurator;
 }
Пример #4
0
 /// <summary>
 /// Initializes the instance.
 /// </summary>
 /// <param name="configurator">An instance of NHibernate configurator</param>
 public NhibernateUnitOfWork(INhibernateConfigurator configurator)
 {
     _configurator = configurator;
 }