NHibernate.cfg.xml文件配置

复制代码
代码
                 NHibernate.cfg.xml文件配置

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
    
<session-factory name="NHibernate.Test">
        
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
        
<property name="connection.connection_string">
      Data Source
=.;database=NHibernateSample; uid=sa;pwd=123;
    
</property>
        
<property name="adonet.batch_size">10</property>
        
<property name="show_sql">true</property>
        
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
        
<property name="use_outer_join">true</property>
        
<property name="command_timeout">10</property>
        
<property name="query.substitutions">true 1false 0, yes 'Y', no 'N'</property>
    
<mapping assembly="DomainModel"/>    
    
</session-factory>
</hibernate-configuration>
//创建数据库
public class DataBase
    {
        
private void CreateDatabase()
        {
            Configuration cfg 
= new Configuration();
            cfg.Configure();
            SchemaExport schema 
= new SchemaExport(cfg);
            
//schema.Drop(true, false);
            schema.SetOutputFile("log.txt");
            schema.Create(
truefalse);
         }
     }
复制代码

 

posted @   Blue Sky ......  阅读(537)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示