zoukankan      html  css  js  c++  java
  • Hibernate配置文件

    var configuration = new NH.Cfg.Configuration();

    configuration.Configure(cfgPath);

    Configuration对象创建后,需要调用Configure()方法来加载配置文件,hibernate默认在app.config和web.config中查找配置,也可以指定配置文件的位置,通常设置为程序输出目录(bin)下“hibernate.cfg.xml”文件。

    程序方式配置

    var configuration = new NH.Cfg.Configuration();

    configuration.SetProperty("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
    configuration.SetProperty("dialect", dialect);
    configuration.SetProperty("connection.driver_class", driver);
    configuration.SetProperty("connection.connection_string", connectionString);
    configuration.SetProperty("connection.release_mode", "on_close");
    configuration.SetProperty("show_sql", "true");

    configuration.AddAssembly("com.xxx");
    configuration.AddAssembly("com.yyy");
    configuration.AddAssembly("com.zzz");

    Configuration对象创建后不需要调用Configure()方法。

  • 相关阅读:
    装饰器和迭代器
    闭包函数
    函数对象
    Python函数
    函数的基本使用
    文件处理
    量化策略
    Android--生命周期
    算法转AI平台工程师记录-0
    python3.6安装
  • 原文地址:https://www.cnblogs.com/davinci/p/3125467.html
Copyright © 2011-2022 走看看