Inheritance: DataAdapter
        public virtual void Load (IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler){
            IntPtr hscp;
            Bid.ScopeEnter(out hscp, "<ds.DataTable.Load|API> %d#, loadOption=%d{ds.LoadOption}\n", ObjectID, (int)loadOption);
            try {
                if (this.PrimaryKey.Length == 0) {
                    DataTableReader dtReader = reader as DataTableReader;
                    if (dtReader != null && dtReader.CurrentDataTable == this)
                        return; // if not return, it will go to infinite loop
                }
                Common.LoadAdapter adapter = new Common.LoadAdapter();
                adapter.FillLoadOption = loadOption;
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                if (null != errorHandler) {
                    adapter.FillError += errorHandler;
                }
                adapter.FillFromReader(new DataTable[] { this }, reader, 0, 0);

                if (!reader.IsClosed && !reader.NextResult()) { // 
                    reader.Close();
                }
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }
 public virtual void Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler, params DataTable[] tables)
 {
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<ds.DataSet.Load|API> reader, loadOption=%d{ds.LoadOption}", (int) loadOption);
     try
     {
         foreach (DataTable table in tables)
         {
             ADP.CheckArgumentNull(table, "tables");
             if (table.DataSet != this)
             {
                 throw ExceptionBuilder.TableNotInTheDataSet(table.TableName);
             }
         }
         LoadAdapter adapter = new LoadAdapter {
             FillLoadOption = loadOption,
             MissingSchemaAction = MissingSchemaAction.AddWithKey
         };
         if (errorHandler != null)
         {
             adapter.FillError += errorHandler;
         }
         adapter.FillFromReader(tables, reader, 0, 0);
         if (!reader.IsClosed && !reader.NextResult())
         {
             reader.Close();
         }
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
        public virtual void Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler, params DataTable[] tables) {
            IntPtr hscp;
            Bid.ScopeEnter(out hscp, "<ds.DataSet.Load|API> reader, loadOption=%d{ds.LoadOption}", (int)loadOption);
            try {
                foreach (DataTable dt in tables) {
                    Common.ADP.CheckArgumentNull(dt, "tables");
                    if (dt.DataSet != this) {
                        throw ExceptionBuilder.TableNotInTheDataSet(dt.TableName);
                    }
                }
                Common.LoadAdapter adapter = new Common.LoadAdapter();
                adapter.FillLoadOption = loadOption;
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                if (null != errorHandler) {
                    adapter.FillError += errorHandler;
                }
                adapter.FillFromReader(tables, reader, 0, 0);

                if (!reader.IsClosed && !reader.NextResult()) { // 
                    reader.Close();
                }
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }
Example #4
0
        public virtual void Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTable.Load|API> {0}, loadOption={1}", ObjectID, loadOption);
            try
            {
                if (PrimaryKey.Length == 0)
                {
                    DataTableReader dtReader = reader as DataTableReader;
                    if (dtReader != null && dtReader.CurrentDataTable == this)
                    {
                        return; // if not return, it will go to infinite loop
                    }
                }
                Common.LoadAdapter adapter = new Common.LoadAdapter();
                adapter.FillLoadOption = loadOption;
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                if (null != errorHandler)
                {
                    adapter.FillError += errorHandler;
                }
                adapter.FillFromReader(new DataTable[] { this }, reader, 0, 0);

                if (!reader.IsClosed && !reader.NextResult())
                {
                    reader.Close();
                }
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }
 public virtual void Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
 {
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<ds.DataTable.Load|API> %d#, loadOption=%d{ds.LoadOption}\n", this.ObjectID, (int) loadOption);
     try
     {
         if (this.PrimaryKey.Length == 0)
         {
             DataTableReader reader2 = reader as DataTableReader;
             if ((reader2 != null) && (reader2.CurrentDataTable == this))
             {
                 return;
             }
         }
         LoadAdapter adapter = new LoadAdapter {
             FillLoadOption = loadOption,
             MissingSchemaAction = MissingSchemaAction.AddWithKey
         };
         if (errorHandler != null)
         {
             adapter.FillError += errorHandler;
         }
         adapter.FillFromReader(new DataTable[] { this }, reader, 0, 0);
         if (!reader.IsClosed && !reader.NextResult())
         {
             reader.Close();
         }
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
Example #6
0
        public virtual void Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler, params DataTable[] tables)
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.Load|API> reader, loadOption={0}", loadOption);
            try
            {
                foreach (DataTable dt in tables)
                {
                    ADP.CheckArgumentNull(dt, nameof(tables));
                    if (dt.DataSet != this)
                    {
                        throw ExceptionBuilder.TableNotInTheDataSet(dt.TableName);
                    }
                }

                var adapter = new LoadAdapter();
                adapter.FillLoadOption = loadOption;
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                if (null != errorHandler)
                {
                    adapter.FillError += errorHandler;
                }
                adapter.FillFromReader(tables, reader, 0, 0);

                if (!reader.IsClosed && !reader.NextResult())
                {
                    reader.Close();
                }
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }