BlToolkit を使用してエンティティを Oracle データベースに挿入しようとしました。接続は System.Data.OracleClient との接続です。ms sqlサーバーですべて問題ありません。しかし、Oracle に移行すると、GUID の挿入でエラーが発生します。選択は完全に機能します。何かアドバイス?
モデル:
[TableName("TEST")]
public class Test
{
[MapField("TEST_ID")]
[PrimaryKey]
public Guid TestId { get; set; }
[DisplayName("Kodu")]
[MapField("TEST_KODU")]
public string TestKodu { get; set; }
[DisplayName("Test Kısa Adı")]
[MapField("TEST_KISA_ADI")]
public string TestKisaAd { get; set; }
[DisplayName("Test Adı")]
[MapField("TEST_ADI")]
public string TestAdi { get; set; }
public Test()
{
}
public Test(Guid _id, string _kod, string _adi, string _kisaAdi)
{
TestId = _id;
TestKodu = _kod;
TestKisaAd = _kisaAdi;
TestAdi = _adi;
}
}
データベースマネージャ:
public class DbProvider : DbManager
{
public DbProvider() : base("ElabConnectionString")
{
}
}
実際に:
var db = new DbProvider();
db.Insert(test);
与えられたエラー:
Hata: BLToolkit.Data.DataException: Failed to convert parameter value from a Guid to a Byte[]. ---> System.InvalidCastException: Failed to convert parameter value from a Guid to a Byte[]. ---> System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Data.OracleClient.OracleParameter.CoerceValue(Object value, MetaType destinationType)
--- End of inner exception stack trace ---
at System.Data.OracleClient.OracleParameter.CoerceValue(Object value, MetaType destinationType)
at System.Data.OracleClient.OracleParameter.SetCoercedValueInternal(Object value, MetaType metaType)
at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset)
at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at BLToolkit.Data.DbManager.ExecuteOperation[T](OperationType operationType, Func`1 operation)
--- End of inner exception stack trace ---
at BLToolkit.Data.DbManager.OnOperationException(OperationType op, DataException ex)
at BLToolkit.Data.DbManager.HandleOperationException(OperationType op, Exception ex)
at BLToolkit.Data.DbManager.ExecuteOperation[T](OperationType operationType, Func`1 operation)
at BLToolkit.Data.DbManager.ExecuteNonQueryInternal()
at BLToolkit.Data.DbManager.ExecuteNonQuery()
at BLToolkit.Data.DbManager.BLToolkit.Data.Linq.IDataContext.ExecuteNonQuery(Object query)
at BLToolkit.Data.Linq.Query`1.NonQueryQuery(IDataContextInfo dataContextInfo, Expression expr, Object[] parameters)
at BLToolkit.Data.Linq.Query`1.<SetNonQueryQuery>b__e(QueryContext ctx, IDataContextInfo db, Expression expr, Object[] ps)
at BLToolkit.Data.Linq.Query`1.Insert(IDataContextInfo dataContextInfo, T obj)
at BLToolkit.Data.Linq.Extensions.Insert[T](IDataContext dataContext, T obj)