zoukankan      html  css  js  c++  java
  • NHibernate学习注意点

    1.

    为Microsoft Visual Studio 2008添加编写NHibernate配置文件智能提示的功能。只要在下载的NHibernate里找到configuration.xsd和nhibernate-mapping.xsd两个文件并复制到X:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas目录即可。

    2.

    NHibernate使用属性的getter和setter来实现持久化。

    属性可设置为public、internal、protected、protected internal或private.

    要求持久化类不是sealed的,而且其公共方法、属性和事件声明为virtual

    3.

    hibernate.cfg.xml文件

    <?xml version="1.0" encoding="utf-8" ?>
    <hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
      <session-factory name="NHFactory">
        <!-- properties -->
        <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
        <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
        <property name="connection.connection_string">Server=YQKC003\SQLEXPRESS;initial catalog=hotelManageDB;integrated security=sspi</property>
        <property name="show_sql">false</property>
        <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property><!--数据库方言-->
        <property name="use_outer_join">true</property>
        <!-- mapping files -->
        <mapping assembly="HotelManageModels" /><!--映射整个持久层的程序集-->
     
      </session-factory>
    </hibernate-configuration>

    完毕!

    此配置也可配置在app.config中进行或在类中

  • 相关阅读:
    WoSign全球可信网站安全认证签章安装指南
    软件测试学习(4)
    软件测试学习(3) 第一次上机实验
    软件测试学习(2)
    C#实验——Problem Statement
    C#实验——Supplementary Specifications
    python— if __name__=='__main__':的作用
    python--网络请求
    python--程序分目录、加环境变量
    python--接口开发
  • 原文地址:https://www.cnblogs.com/zhangqifeng/p/1418914.html
Copyright © 2011-2022 走看看