How to use Oracle.ManagedDataAccess.Core driver with Nhibernate 5 targeting .NET 5? #2907
-
How can we use https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/ for project targeting .NET 5(Cross platform deployment) and Oracle 12c Database? I can see that https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate/Driver folder has OracleManagedDataClientDriver.cs file using Oracle.ManagedDataAccess driver.
Questions
@bahusoid , @fredericDelaporte , @hazzik , your thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Just set "connection.driver_class" to "NHibernate.Driver.OracleManagedDataClientDriver" and "dialect" to "NHibernate.Dialect.Oracle12cDialect" in your configuration file. Don't need to create any classes or anything. <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleManagedDataClientDriver</property>
<property name="connection.connection_string">
User ID=nhibernate;Password=nhibernate;Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL)))
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle12cDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<!-- If your database setup use an ASCII charset, switch following property to true. -->
<property name="oracle.use_n_prefixed_types_for_unicode">false</property>
<!-- Depending on your database setup, the default cast length of 4000 may be too big.
By example, if previous setting is true, NHibernate may try to use nvarchar2(4000),
which will be rejected if its underlying charset is UTF16 and the database
MAX_STRING_SIZE is not extended. In such case, reduce it to 2000. -->
<property name="query.default_cast_length"></property>
</session-factory>
</hibernate-configuration>
We run 2.19.x driver just because our tests still target .NET Core 2.0 as we've been lazy to upgrade the test suite. I've run locally .NET 6.0 and most test do work as expected. |
Beta Was this translation helpful? Give feedback.
Just set "connection.driver_class" to "NHibernate.Driver.OracleManagedDataClientDriver" and "dialect" to "NHibernate.Dialect.Oracle12cDialect" in your configuration file. Don't need to create any classes or anything.