Tag Archives: System.InvalidOperationException

Abnormal [System.InvalidOperationException: custom type mapping for ‘xxx’ is not specified or is not a solution

In the use of C # code to get data from Oracle database, but because it is an object-oriented way, the model object in C # is also established in Oracle, and the corresponding mapping should be done in the Oracle connection code of C #.

When running, this exception is thrown:

ex=System.InvalidOperationException: Custom type mapping not specified with 'dataSource='xxxxxxx' schemaName='xxx' typeName='xxx' or the mapping is invalid
   at Oracle.DataAccess.Types.OracleUdt.GetFactory(OracleUdtDescriptor udtDesc)
   at Oracle.DataAccess.Client.OracleParameter.SetUDTFromArray(OracleConnection conn, Object array, Int32 i)
   at Oracle.DataAccess.Client.OracleParameter.PreBind_Collection(OracleConnection conn)
   at Oracle.DataAccess.Client.OracleParameter.PreBind(OracleConnection conn, IntPtr errCtx, Int32 arraySize)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
   at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at HCC.Base.Comm.Dao.OraHelper.ExecuteDataTableSp(String dbkey, String procName, List`1 prams) 

Through various searches, it is found that the source of the problem lies in accidentally writing the udttypename wrong in the mapping code, which leads to this exception. Correct the spelling of udttypename to make the code work properly.