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()方法。

  • 相关阅读:
    第03组 Alpha冲刺(3/6)
    第03组 Alpha冲刺(2/6)
    第03组 Alpha冲刺(1/6)
    团队项目-选题报告
    第3组 团队展示
    福大软工 · BETA 版冲刺前准备(团队)
    Alpha 事后诸葛亮
    Alpha冲刺
    Alpha冲刺-(9/10)
    Alpha冲刺
  • 原文地址:https://www.cnblogs.com/davinci/p/3125467.html
Copyright © 2011-2022 走看看