jagath kishor

jagath kishor

  • NA
  • 2
  • 2.8k

Sending object(containingproperty return array of sub object

Feb 19 2015 6:36 AM
Hi ,
we have a UDT CREATE OR REPLACE TYPE VATP_DIT."XXAR_INVOICE_LINES" AS TABLE OF XXAR_INVOICE_LINE
CREATE OR REPLACE TYPE VATP_DIT."XXAR_INVOICE_LINE"
CREATE OR REPLACE TYPE VATP_DIT."XXAR_INVOICE" AS OBJECT
(
INVOICE_ID NUMBER,
INVOICE_NO VARCHAR2(20),
INVOICE_LINES XXAR_INVOICE_LINES
) ;
so we have three UDts XXAR_INVOICE contains XXAR_INVOICE_LINES
stored procedure takes an arugument like PROCEDURE MAIN_IMPORT(pInvoice IN XXAR_INVOICE);
So in c# i am creating Invoice, Invoiceline , InvoiceLines
InvoiceLines.cs
========
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace DBConnect
{
public class InvoiceLines
{
public InvoiceLine[] INVOICELINE;
[OracleArrayMapping]
public InvoiceLine[] InvoiceLineArray { get{return INVOICELINE;} set{INVOICELINE=value;}}
}
}
InvoiceLine.cs
==========
public class InvoiceLine:IOracleCustomType
{
[OracleObjectMappingAttribute("ITEM_SERIAL_NUMBER")]
public virtual int ItemSerialNum { get{return ITEM_SERIAL_NUMBR;} set{ITEM_SERIAL_NUMBR=value;} }
[OracleObjectMappingAttribute("PARENT_LINE_NUMBER")]
public virtual int ParentLineNumber { get{return PARENT_LINE_NUMBER;} set{PARENT_LINE_NUMBER=value;} }
}
public virtual void FromCustomObject(Oracle.DataAccess.Client.OracleConnection objCon, IntPtr objUdt)
{
OracleUdt.SetValue(objCon, objUdt, "ITEM_SERIAL_NUMBER", this.ItemSerialNum);
OracleUdt.SetValue(objCon, objUdt, "PARENT_LINE_NUMBER", this.ParentLineNumber);
[OracleCustomTypeMappingAttribute("SERVICE_VATPADMIN.XXAR_INVOICE_LINE")]
public class InvoiceLineFactory : IOracleCustomTypeFactory
{
public virtual IOracleCustomType CreateObject()
{
InvoiceLine objInvoiceLine = new InvoiceLine();
return objInvoiceLine;
}
}
Invoice.cs
=======
public class Invoice:IOracleCustomType
{
InvoiceLines invoiceLines = new InvoiceLines();
public string INVOICE_NO;
public int INVOICE_ID;//
[OracleObjectMappingAttribute("INVOICE_NO")]
public string InvoiceNum { get{return INVOICE_NO;} set{INVOICE_NO=value;} }
[OracleObjectMappingAttribute("INVOICE_ID")]
public int InvoiceID { get{return INVOICE_ID;} set{INVOICE_ID=value;} }
[OracleArrayMapping]
public InvoiceLine[] InvoiceLineArray { get{return invoiceLines.InvoiceLineArray;} }
public void FromCustomObject(Oracle.DataAccess.Client.OracleConnection objCon, IntPtr objUdt)
{
OracleUdt.SetValue(objCon, objUdt, "INVOICE_NO", this.InvoiceNum);
OracleUdt.SetValue(objCon, objUdt, "INVOICE_ID", this.InvoiceID);
OracleUdt.SetValue(objCon, objUdt, "INVOICELINE",this.InvoiceLineArray, InvoiceLineArray);
}
But here in FromCustomObject the first lines are passed successfully but in third line mapping
OracleUdt.SetValue(objCon, objUdt, "INVOICELINE",this.InvoiceLineArray, InvoiceLineArray);
getting Object attribute is not mapped to a custom type member. this error so please help me to resolve this . How to map array of objects in oracle