コード例 #1
0
        [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]                           // MDAC 82936
        virtual protected DataAdapter CloneInternals()
        {                                                                                                                                                     // V1.0.3300
            DataAdapter clone = (DataAdapter)Activator.CreateInstance(GetType(), System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, null, CultureInfo.InvariantCulture, null);

            clone.CloneFrom(this);
            return(clone);
        }
コード例 #2
0
        protected ProxyDataAdapter(DataAdapter subject)
        // The `from` clone ctor copies state over. Which is fine as that sets initial state.
            : base(from: subject ?? throw new ArgumentNullException(nameof(subject)))
        {
            this.subject = subject ?? throw new ArgumentNullException(nameof(subject));

            this.subject.FillError += this.OnSubjectFillError;
        }
コード例 #3
0
        private SchemaMapping FillMappingInternal(DataSet dataset, DataTable datatable, string srcTable, DataReaderContainer dataReader, int schemaCount, DataColumn parentChapterColumn, object parentChapterValue)
        {
            bool   withKeyInfo = (MissingSchemaAction.AddWithKey == MissingSchemaAction);
            string tmp         = null;

            if (null != dataset)
            {
                tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount);
            }
            return(new SchemaMapping(this, dataset, datatable, dataReader, withKeyInfo, SchemaType.Mapped, tmp, true, parentChapterColumn, parentChapterValue));
        }
コード例 #4
0
        internal async Task <object> FillSchemaFromReaderAsync(DataSet dataset, DataTable datatable, SchemaType schemaType, string srcTable, DbDataReader dataReader)
        {
            DataTable[] dataTables  = null;
            int         schemaCount = 0;

            do
            {
                DataReaderContainer readerHandler = DataReaderContainer.Create(dataReader, ReturnProviderSpecificTypes);

                AssertReaderHandleFieldCount(readerHandler);
                if (0 >= readerHandler.FieldCount)
                {
                    continue;
                }
                string tmp = null;
                if (null != dataset)
                {
                    tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount);
                    schemaCount++; // don't increment if no SchemaTable ( a non-row returning result )
                }

                SchemaMapping mapping = new SchemaMapping(this, dataset, datatable, readerHandler, true, schemaType, tmp, false, null, null);

                if (null != datatable)
                {
                    // do not read remaining results in single DataTable case
                    return(mapping.DataTable);
                }
                else if (null != mapping.DataTable)
                {
                    if (null == dataTables)
                    {
                        dataTables = new DataTable[1] {
                            mapping.DataTable
                        };
                    }
                    else
                    {
                        dataTables = DataAdapter.AddDataTableToArray(dataTables, mapping.DataTable);
                    }
                }
            } while (await dataReader.NextResultAsync()); // FillSchema does not capture errors for FillError event

            object value = dataTables;

            if ((null == value) && (null == datatable))
            { // WebData 101757
                value = new DataTable[0];
            }
            return(value); // null if datatable had no results
        }
コード例 #5
0
        private void CloneFrom(DataAdapter from)
        {
            _acceptChangesDuringUpdate            = from._acceptChangesDuringUpdate;
            _acceptChangesDuringUpdateAfterInsert = from._acceptChangesDuringUpdateAfterInsert;
            _continueUpdateOnError       = from._continueUpdateOnError;
            _returnProviderSpecificTypes = from._returnProviderSpecificTypes; // WebData 101795
            _acceptChangesDuringFill     = from._acceptChangesDuringFill;
            _fillLoadOption       = from._fillLoadOption;
            _missingMappingAction = from._missingMappingAction;
            _missingSchemaAction  = from._missingSchemaAction;

            if ((null != from._tableMappings) && (0 < from.TableMappings.Count))
            {
                DataTableMappingCollection parameters = this.TableMappings;
                foreach (object parameter in from.TableMappings)
                {
                    parameters.Add((parameter is ICloneable) ? ((ICloneable)parameter).Clone() : parameter);
                }
            }
        }
コード例 #6
0
 protected DataAdapter(DataAdapter from) : base()
 { // V1.1.3300
     CloneFrom(from);
 }