Я не знаю, чего мне не хватает для ManagedDataAccess, чтобы пожаловаться на «Неподдерживаемый тип данных столбца». Мне нравится, что ошибка не указывает на то, какой тип или какая «колонка» вызывает у нее горе. Может кто-нибудь просмотреть код ниже и сообщить мне, что я пропустил? Большое спасибо!
Таблица
CREATE TABLE "PORTAL_OPS"."SHAPE"
(
"SIDES" NUMBER(1,0) NOT NULL ENABLE
)
Тип
create or replace type shapeudt as object
(
sides number(1,0)
)
Класс
[OracleCustomTypeMappingAttribute("PORTAL_OPS.SHAPEUDT")]
public class Shape : IOracleCustomType, IOracleCustomTypeFactory
{
[OracleObjectMappingAttribute("SIDES")]
public Int32 sides;
public void FromCustomObject(OracleConnection con, IntPtr pUdt)
{
OracleUdt.SetValue(con, pUdt, "SIDES", sides);
}
public void ToCustomObject(OracleConnection con, IntPtr pUdt)
{
sides = (int)OracleUdt.GetValue(con, pUdt, "SIDES");
}
public IOracleCustomType CreateObject()
{
return new Shape();
}
}
Вызов UDT для процедуры :
// setting up the parameter
OracleParameter param = new OracleParameter();
param.Direction = ParameterDirection.Input;
//param.UdtTypeName = udt.DatabaseTypeName;
param.DbType = DbType.Object;
// this needs to stay at the end...if you move it ahead of the
// previous line, you will get
// "Value does not fall within the expected range" error
param.Value = udt;
Command.CommandText = "portal_ops.PROC_CREATE_SHAPE";
Command.CommandType = CommandType.StoredProcedure;
Command.Parameters.Add(param);
if (Command.Connection.State == ConnectionState.Closed)
{
Command.Connection.Open();
}
Command.ExecuteNonQuery();
Command.Dispose();
Command.Connection.Close();