官方没有提供链接access数据的专门的类,建议使用NHibernate.Dialect.SybaseDialect。它可以兼容对access数据库的操作。
方法:在app.config文件中配置如下信息:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="masparameter">
<property name="dialect">NHibernate.Dialect.SybaseDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
<property name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\WorkPlatform.mdb</property>
<property name="connection.isolation">ReadCommitted</property>
<!-- HBM Mapping Files -->
<mapping assembly="MOD" />
</session-factory>
</hibernate-configuration>
方法:在app.config文件中配置如下信息:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="masparameter">
<property name="dialect">NHibernate.Dialect.SybaseDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
<property name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\WorkPlatform.mdb</property>
<property name="connection.isolation">ReadCommitted</property>
<!-- HBM Mapping Files -->
<mapping assembly="MOD" />
</session-factory>
</hibernate-configuration>
|DataDirectory|数据库放在app_data文件夹下