예제 #1
0
        /// <summary>
        /// Create the specified database schema category.
        /// Remember that these methods delete any existing data on the database and recreate the database structure.
        /// </summary>
        /// <param name="section"></param>
        public void CreateSchemaTable(string schemaCategory)
        {
            NHibernate.Cfg.Configuration hibConfig =
                mConfiguration.CreateNHibernateConfiguration(ConfigurationFlags.Settings);

            Type[] entities = GetEntities(schemaCategory);

            foreach (Type ent in entities)
            {
                if (ent != null)
                {
                    hibConfig.AddClass(ent);
                }
            }

            var ddlExport = new SchemaExport(hibConfig);

            ddlExport.Create(false, true);
        }