这是我在此工作以来的一点,目前我没有工作项目来证实这一问题,但我要说,这将解决你的问题。
我如何解决这一问题,就是在“自由”项目中进行习俗建设。 I edited the OracleDataClienthangr.cs file with the edits below. 你们应该指出,我刚刚下载了目前版本的档案,而且自我发言以来,过去两年来,这一版本略有变化。 如果你从NHibernate repo获得目前版本的档案,并且把档案与法典分开,我就会看到这些变化。 我的改动是线数(根据我的编辑)26、45、82-85。
固定装置的主题是,我不得不在XML的Oracle数据类型中增加从NHibernate绘图文档类型中绘制的地图。 甲骨质的司机将处理这类问题,但是在NHibernate使用这种疾病的逻辑缺失。 以下是这方面的规定。
开始仪式
using System.Data;
using System.Reflection;
using NHibernate.AdoNet;
using NHibernate.Engine.Query;
using NHibernate.SqlTypes;
using NHibernate.Util;
namespace NHibernate.Driver
{
/// <summary>
/// A NHibernate Driver for using the Oracle.DataAccess DataProvider
/// </summary>
/// <remarks>
/// Code was contributed by <a href="http://sourceforge.net/users/jemcalgary/">James Mills</a>
/// on the NHibernate forums in this
/// <a href="http://sourceforge.net/forum/message.php?msg_id=2952662">post</a>.
/// </remarks>
public class OracleDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider
{
private const string driverAssemblyName = "Oracle.DataAccess";
private const string connectionTypeName = "Oracle.DataAccess.Client.OracleConnection";
private const string commandTypeName = "Oracle.DataAccess.Client.OracleCommand";
private static readonly SqlType GuidSqlType = new SqlType(DbType.Binary, 16);
private readonly PropertyInfo oracleDbType;
private readonly object oracleDbTypeRefCursor;
private readonly object oracleDbTypeXmlType;
/// <summary>
/// Initializes a new instance of <see cref="OracleDataClientDriver"/>.
/// </summary>
/// <exception cref="HibernateException">
/// Thrown when the <c>Oracle.DataAccess</c> assembly can not be loaded.
/// </exception>
public OracleDataClientDriver()
: base(
driverAssemblyName,
connectionTypeName,
commandTypeName)
{
System.Type parameterType = ReflectHelper.TypeFromAssembly("Oracle.DataAccess.Client.OracleParameter", driverAssemblyName, false);
oracleDbType = parameterType.GetProperty("OracleDbType");
System.Type oracleDbTypeEnum = ReflectHelper.TypeFromAssembly("Oracle.DataAccess.Client.OracleDbType", driverAssemblyName, false);
oracleDbTypeRefCursor = System.Enum.Parse(oracleDbTypeEnum, "RefCursor");
oracleDbTypeXmlType = System.Enum.Parse(oracleDbTypeEnum, "XmlType");
}
/// <summary></summary>
public override bool UseNamedPrefixInSql
{
get { return true; }
}
/// <summary></summary>
public override bool UseNamedPrefixInParameter
{
get { return true; }
}
/// <summary></summary>
public override string NamedPrefix
{
get { return ":"; }
}
/// <remarks>
/// This adds logic to ensure that a DbType.Boolean parameter is not created since
/// ODP.NET doesn t support it.
/// </remarks>
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
// if the parameter coming in contains a boolean then we need to convert it
// to another type since ODP.NET doesn t support DbType.Boolean
switch (sqlType.DbType)
{
case DbType.Boolean:
base.InitializeParameter(dbParam, name, SqlTypeFactory.Int16);
break;
case DbType.Guid:
base.InitializeParameter(dbParam, name, GuidSqlType);
break;
case DbType.Xml:
dbParam.ParameterName = base.FormatNameForParameter(name);
oracleDbType.SetValue(dbParam, oracleDbTypeXmlType, null);
break;
default:
base.InitializeParameter(dbParam, name, sqlType);
break;
}
}
protected override void OnBeforePrepare(IDbCommand command)
{
base.OnBeforePrepare(command);
CallableParser.Detail detail = CallableParser.Parse(command.CommandText);
if (!detail.IsCallable)
return;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = detail.FunctionName;
IDbDataParameter outCursor = command.CreateParameter();
oracleDbType.SetValue(outCursor, oracleDbTypeRefCursor, null);
outCursor.Direction = detail.HasReturn ? ParameterDirection.ReturnValue : ParameterDirection.Output;
command.Parameters.Insert(0, outCursor);
}
#region IEmbeddedBatcherFactoryProvider Members
System.Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass
{
get { return typeof (OracleDataClientBatchingBatcherFactory); }
}
#endregion
}
终结