• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MissingSchemaAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MissingSchemaAction的典型用法代码示例。如果您正苦于以下问题:C# MissingSchemaAction类的具体用法?C# MissingSchemaAction怎么用?C# MissingSchemaAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MissingSchemaAction类属于命名空间,在下文中一共展示了MissingSchemaAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Merge

		internal static void Merge(DataSet targetSet, DataRow[] sourceRows, bool preserveChanges, MissingSchemaAction missingSchemaAction)
		{
			if(targetSet == null)
				throw new ArgumentNullException("targetSet");
			if(sourceRows == null)
				throw new ArgumentNullException("sourceRows");

			bool savedEnfoceConstraints = targetSet.EnforceConstraints;
			targetSet.EnforceConstraints = false;

			ArrayList targetTables = new ArrayList();
			for (int i = 0; i < sourceRows.Length; i++) {
				DataRow row = sourceRows[i];
				DataTable sourceTable = row.Table;
				DataTable targetTable = null;
				if (!AdjustSchema(targetSet, sourceTable, missingSchemaAction,ref targetTable)) {
					return;
				}
				if (targetTable != null) {
					checkColumnTypes(targetTable, row.Table);
					MergeRow(targetTable, row, preserveChanges);
					if (!(targetTables.IndexOf(targetTable) >= 0)) {
						targetTables.Add(targetTable);
					}
				}
			}

			targetSet.EnforceConstraints = savedEnfoceConstraints;

			foreach(DataTable table in targetTables) {
				table.ResetIndexes();
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:MergeManager.cs


示例2: GetDataTableBySchemaAction

        public DataTable GetDataTableBySchemaAction(DataSet dataSet, MissingSchemaAction schemaAction)
        {
            if (dataSet == null)
            {
                throw ADP.ArgumentNull("dataSet");
            }
            string dataSetTable = this.DataSetTable;
            if (ADP.IsEmpty(dataSetTable))
            {
                return null;
            }
            DataTableCollection tables = dataSet.Tables;
            int index = tables.IndexOf(dataSetTable);
            if ((0 <= index) && (index < tables.Count))
            {
                return tables[index];
            }
            switch (schemaAction)
            {
                case MissingSchemaAction.Add:
                case MissingSchemaAction.AddWithKey:
                    return new DataTable(dataSetTable);

                case MissingSchemaAction.Ignore:
                    return null;

                case MissingSchemaAction.Error:
                    throw ADP.MissingTableSchema(dataSetTable, this.SourceTable);
            }
            throw ADP.InvalidMissingSchemaAction(schemaAction);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:DataTableMapping.cs


示例3: DataAdapter

		protected DataAdapter () 
		{
			acceptChangesDuringFill = true;
			continueUpdateOnError = false;
			missingMappingAction = MissingMappingAction.Passthrough;
			missingSchemaAction = MissingSchemaAction.Add;
			tableMappings = new DataTableMappingCollection ();
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:DataAdapter.cs


示例4: GetDataColumnBySchemaAction

        public static DataColumn GetDataColumnBySchemaAction(string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)
        {
            if (null == dataTable)
            {
                throw ADP.ArgumentNull(nameof(dataTable));
            }
            if (string.IsNullOrEmpty(dataSetColumn))
            {
#if DEBUG
                if (AdapterSwitches.DataSchema.TraceWarning)
                {
                    Debug.WriteLine("explicit filtering of SourceColumn \"" + sourceColumn + "\"");
                }
#endif
                return null;
            }
            DataColumnCollection columns = dataTable.Columns;
            Debug.Assert(null != columns, "GetDataColumnBySchemaAction: unexpected null DataColumnCollection");

            int index = columns.IndexOf(dataSetColumn);
            if ((0 <= index) && (index < columns.Count))
            {
                DataColumn dataColumn = columns[index];
                Debug.Assert(null != dataColumn, "GetDataColumnBySchemaAction: unexpected null dataColumn");

                if (!string.IsNullOrEmpty(dataColumn.Expression))
                {
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceError)
                    {
                        Debug.WriteLine("schema mismatch on DataColumn \"" + dataSetColumn + "\" which is a computed column");
                    }
#endif
                    throw ADP.ColumnSchemaExpression(sourceColumn, dataSetColumn);
                }
                if ((null == dataType) || (dataType.IsArray == dataColumn.DataType.IsArray))
                {
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceInfo)
                    {
                        Debug.WriteLine("schema match on DataColumn \"" + dataSetColumn + "\"");
                    }
#endif
                    return dataColumn;
                }
#if DEBUG
                if (AdapterSwitches.DataSchema.TraceWarning)
                {
                    Debug.WriteLine("schema mismatch on DataColumn \"" + dataSetColumn + "\" " + dataType.Name + " != " + dataColumn.DataType.Name);
                }
#endif
                throw ADP.ColumnSchemaMismatch(sourceColumn, dataType, dataColumn);
            }

            return CreateDataColumnBySchemaAction(sourceColumn, dataSetColumn, dataTable, dataType, schemaAction);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:56,代码来源:DataColumnMapping.cs


示例5: Merger

        private bool _IgnoreNSforTableLookup = false; // Everett Behavior : SQL BU DT 370850

        internal Merger(DataSet dataSet, bool preserveChanges, MissingSchemaAction missingSchemaAction) {
            this.dataSet = dataSet;
            this.preserveChanges = preserveChanges;

            // map AddWithKey -> Add
            if (missingSchemaAction == MissingSchemaAction.AddWithKey)
                this.missingSchemaAction = MissingSchemaAction.Add;
            else
                this.missingSchemaAction = missingSchemaAction;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:Merger.cs


示例6: Merger

        private bool _IgnoreNSforTableLookup = false; // Everett Behavior : SQL BU DT 370850

        internal Merger(DataSet dataSet, bool preserveChanges, MissingSchemaAction missingSchemaAction)
        {
            _dataSet = dataSet;
            _preserveChanges = preserveChanges;

            // map AddWithKey -> Add
            _missingSchemaAction = missingSchemaAction == MissingSchemaAction.AddWithKey ?
                MissingSchemaAction.Add :
                missingSchemaAction;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:Merger.cs


示例7: GetDataColumnBySchemaAction

		public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) 
		{
			if (dataTable.Columns.Contains (dataSetColumn))
				return dataTable.Columns [dataSetColumn];
			if (schemaAction == MissingSchemaAction.Ignore)
				return null;
			if (schemaAction == MissingSchemaAction.Error)
				throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn));
			return new DataColumn (dataSetColumn, dataType);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:DataColumnMapping.cs


示例8: DataAdapter

		protected DataAdapter () 
		{
			acceptChangesDuringFill = true;
			continueUpdateOnError = false;
			missingMappingAction = MissingMappingAction.Passthrough;
			missingSchemaAction = MissingSchemaAction.Add;
			tableMappings = new DataTableMappingCollection ();
			acceptChangesDuringUpdate = true;
			fillLoadOption = LoadOption.OverwriteChanges;
			returnProviderSpecificTypes = false;
		}
开发者ID:shana,项目名称:mono,代码行数:11,代码来源:DataAdapter.cs


示例9: Merge

		internal static void Merge(DataSet targetSet, DataTable sourceTable, bool preserveChanges, MissingSchemaAction missingSchemaAction)
		{
			if(targetSet == null)
				throw new ArgumentNullException("targetSet");
			if(sourceTable == null)
				throw new ArgumentNullException("sourceTable");
			if (sourceTable.DataSet == targetSet)
				return;

			bool savedEnfoceConstraints = targetSet.EnforceConstraints;
			targetSet.EnforceConstraints = false;

			DataTable targetTable = null;
			if (!AdjustSchema(targetSet, sourceTable, missingSchemaAction,ref targetTable))
				return;
			if (targetTable != null)
				fillData(targetTable, sourceTable, preserveChanges);
			targetSet.EnforceConstraints = savedEnfoceConstraints;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:19,代码来源:MergeManager.cs


示例10: GetDataColumnBySchemaAction

        public static DataColumn GetDataColumnBySchemaAction(string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)
        {
            if (dataTable == null)
            {
                throw ADP.ArgumentNull("dataTable");
            }
            if (ADP.IsEmpty(dataSetColumn))
            {
                return null;
            }
            DataColumnCollection columns = dataTable.Columns;
            int index = columns.IndexOf(dataSetColumn);
            if ((0 <= index) && (index < columns.Count))
            {
                DataColumn column = columns[index];
                if (!ADP.IsEmpty(column.Expression))
                {
                    throw ADP.ColumnSchemaExpression(sourceColumn, dataSetColumn);
                }
                if ((null != dataType) && (dataType.IsArray != column.DataType.IsArray))
                {
                    throw ADP.ColumnSchemaMismatch(sourceColumn, dataType, column);
                }
                return column;
            }
            switch (schemaAction)
            {
                case MissingSchemaAction.Add:
                case MissingSchemaAction.AddWithKey:
                    return new DataColumn(dataSetColumn, dataType);

                case MissingSchemaAction.Ignore:
                    return null;

                case MissingSchemaAction.Error:
                    throw ADP.ColumnSchemaMissing(dataSetColumn, dataTable.TableName, sourceColumn);
            }
            throw ADP.InvalidMissingSchemaAction(schemaAction);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:39,代码来源:DataColumnMapping.cs


示例11: AdjustSchema

		// adjust the table schema according to the missingschemaaction param.
		// return false if adjusting fails.
		private static bool AdjustSchema(DataSet targetSet, DataTable sourceTable, MissingSchemaAction missingSchemaAction, ref DataTable newTable)
		{
			string tableName = sourceTable.TableName;
			
			// if the source table not exists in the target dataset
			// we act according to the missingschemaaction param.
			int tmp = targetSet.Tables.IndexOf(tableName);
			// we need to check if it is equals names
			if (tmp != -1 && !targetSet.Tables[tmp].TableName.Equals(tableName))
				tmp = -1;
			if (tmp == -1) {
				if (missingSchemaAction == MissingSchemaAction.Ignore) {
					return true;
				}
				if (missingSchemaAction == MissingSchemaAction.Error) {
					throw new ArgumentException("Target DataSet missing definition for "+ tableName + ".");
				}
				
				DataTable cloneTable = (DataTable)sourceTable.Clone();
				targetSet.Tables.Add(cloneTable);
				tableName = cloneTable.TableName;
			}								
			
			DataTable table = targetSet.Tables[tableName];
			
			for (int i = 0; i < sourceTable.Columns.Count; i++) {
				DataColumn sourceColumn = sourceTable.Columns[i];
				// if a column from the source table doesn't exists in the target table
				// we act according to the missingschemaaction param.
				DataColumn targetColumn = table.Columns[sourceColumn.ColumnName];
				if(targetColumn == null) {
					if (missingSchemaAction == MissingSchemaAction.Ignore) {
						continue;
					}
					if (missingSchemaAction == MissingSchemaAction.Error) {
						throw new ArgumentException(("Column '" + sourceColumn.ColumnName + "' does not belong to table Items."));
					}
					
					targetColumn = new DataColumn(sourceColumn.ColumnName, sourceColumn.DataType, sourceColumn.Expression, sourceColumn.ColumnMapping);
					table.Columns.Add(targetColumn);
				}

				if (sourceColumn.Unique) {
					try {
						targetColumn.Unique = sourceColumn.Unique;
					}
					catch(Exception e){
//						Console.WriteLine("targetColumn : {0}   targetTable : {1} ",targetColumn.ColumnName,table.TableName);
						foreach(DataRow row in table.Rows) {
//							Console.WriteLine(row[targetColumn]);
						}
						throw e;
					}
				}

				if(sourceColumn.AutoIncrement) {
					targetColumn.AutoIncrement = sourceColumn.AutoIncrement;
					targetColumn.AutoIncrementSeed = sourceColumn.AutoIncrementSeed;
					targetColumn.AutoIncrementStep = sourceColumn.AutoIncrementStep;
				}
			}

			if (!AdjustPrimaryKeys(table, sourceTable)) {
				return false;
			}

			newTable = table;
			return true;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:71,代码来源:MergeManager.cs


示例12: SetupSchemaWithKeyInfo

        private object[] SetupSchemaWithKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, bool gettingData, DataColumn parentChapterColumn, object chapterValue) {
            // must sort rows from schema table by ordinal because Jet is sorted by coumn name
            DbSchemaRow[] schemaRows = DbSchemaRow.GetSortedSchemaRows(_schemaTable, _dataReader.ReturnProviderSpecificTypes); // MDAC 60609
            Debug.Assert(null != schemaRows, "SchemaSetup - null DbSchemaRow[]");
            Debug.Assert(_dataReader.FieldCount <= schemaRows.Length, "unexpected fewer rows in Schema than FieldCount");

            if (0 == schemaRows.Length) {
                _dataTable = null;
                return (object[])null;
            }

            // Everett behavior, always add a primary key if a primary key didn't exist before
            // Whidbey behavior, same as Everett unless using LoadOption then add primary key only if no columns previously existed
            bool addPrimaryKeys = (((0 == _dataTable.PrimaryKey.Length) && ((4 <= (int)_loadOption) || (0 == _dataTable.Rows.Count)))
                                    || (0 == _dataTable.Columns.Count)); // MDAC 67033

            DataColumn[] keys = null;
            int keyCount = 0;
            bool isPrimary = true; // assume key info (if any) is about a primary key

            string keyBaseTable = null;
            string commonBaseTable = null;

            bool keyFromMultiTable = false;
            bool commonFromMultiTable = false;

            int[] columnIndexMap = null;
            bool[] chapterIndexMap = null;

            int mappingCount = 0;

            object[] dataValues = null;
            List<object> addedItems = null;
            DataColumnCollection columnCollection = _dataTable.Columns;
            try {
                for(int sortedIndex = 0; sortedIndex < schemaRows.Length; ++sortedIndex) {
                    DbSchemaRow schemaRow = schemaRows[sortedIndex];

                    int unsortedIndex = schemaRow.UnsortedIndex; // MDAC 67050

                    bool ischapter = false;
                    Type fieldType = schemaRow.DataType;
                    if (null == fieldType) {
                        fieldType = _dataReader.GetFieldType(sortedIndex);
                    }
                    if (null == fieldType) {
                        throw ADP.MissingDataReaderFieldType(sortedIndex);
                    }

                    // if IDataReader, hierarchy exists and we will use an Int32,AutoIncrementColumn in this table
                    if (typeof(IDataReader).IsAssignableFrom(fieldType)) {
                        if (null == chapterIndexMap) {
                            chapterIndexMap = new bool[schemaRows.Length];
                        }
                        chapterIndexMap[unsortedIndex] = ischapter = true;
                        fieldType = typeof(Int32);
                    }
                    else if (typeof(System.Data.SqlTypes.SqlXml).IsAssignableFrom(fieldType)) {
                        if (null == _xmlMap) {
                            _xmlMap = new int[schemaRows.Length];
                        }
                        _xmlMap[sortedIndex] = SqlXml;
                    }
                    else if (typeof(System.Xml.XmlReader).IsAssignableFrom(fieldType)) {
                        fieldType = typeof(String);
                        if (null == _xmlMap) {
                            _xmlMap = new int[schemaRows.Length];
                        }
                        _xmlMap[sortedIndex] = XmlDocument;
                    }

                    DataColumn dataColumn = null;
                    if (!schemaRow.IsHidden ) {
                        dataColumn = _tableMapping.GetDataColumn(_fieldNames[sortedIndex], fieldType, _dataTable, mappingAction, schemaAction);
                    }

                    string basetable = /*schemaRow.BaseServerName+schemaRow.BaseCatalogName+schemaRow.BaseSchemaName+*/ schemaRow.BaseTableName;
                    if (null == dataColumn) {
                        if (null == columnIndexMap) {
                            columnIndexMap = CreateIndexMap(schemaRows.Length, unsortedIndex);
                        }
                        columnIndexMap[unsortedIndex] = -1;

                        // if the column is not mapped and it is a key, then don't add any key information
                        if (schemaRow.IsKey) { // MDAC 90822
#if DEBUG
                            if (AdapterSwitches.DataSchema.TraceVerbose) {
                                Debug.WriteLine("SetupSchema: partial primary key detected");
                            }
#endif
                            // if the hidden key comes from a different table - don't throw away the primary key
                            // example SELECT [T2].[ID], [T2].[ProdID], [T2].[VendorName] FROM [Vendor] AS [T2], [Prod] AS [T1] WHERE (([T1].[ProdID] = [T2].[ProdID]))
                            if (keyFromMultiTable || (schemaRow.BaseTableName == keyBaseTable)) { // WebData 100376
                                addPrimaryKeys = false; // don't add any future keys now
                                keys = null; // get rid of any keys we've seen
                            }
                        }
                        continue; // null means ignore (mapped to nothing)
                    }
                    else if ((null != _xmlMap) && (0 != _xmlMap[sortedIndex])) {
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:SchemaMapping.cs


示例13: SetupSchemaWithoutKeyInfo

        private object[] SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, bool gettingData, DataColumn parentChapterColumn, object chapterValue) {
            int[] columnIndexMap = null;
            bool[] chapterIndexMap = null;

            int mappingCount = 0;
            int count = _dataReader.FieldCount;

            object[] dataValues = null;
            List<object> addedItems = null;
            try {
                DataColumnCollection columnCollection = _dataTable.Columns;
                columnCollection.EnsureAdditionalCapacity(count + (chapterValue != null ? 1 : 0));
                // We can always just create column if there are no existing column or column mappings, and the mapping action is passthrough
                bool alwaysCreateColumns = ((_dataTable.Columns.Count == 0) && ((_tableMapping.ColumnMappings == null) || (_tableMapping.ColumnMappings.Count == 0)) && (mappingAction == MissingMappingAction.Passthrough));

                for (int i = 0; i < count; ++i) {

                    bool ischapter = false;
                    Type fieldType = _dataReader.GetFieldType(i);

                    if (null == fieldType) {
                        throw ADP.MissingDataReaderFieldType(i);
                    }

                    // if IDataReader, hierarchy exists and we will use an Int32,AutoIncrementColumn in this table
                    if (typeof(IDataReader).IsAssignableFrom(fieldType)) {
                        if (null == chapterIndexMap) {
                            chapterIndexMap = new bool[count];
                        }
                        chapterIndexMap[i] = ischapter = true;
                        fieldType = typeof(Int32);
                    }
                    else if (typeof(System.Data.SqlTypes.SqlXml).IsAssignableFrom(fieldType)) {
                        if (null == _xmlMap) { // map to DataColumn with DataType=typeof(SqlXml)
                            _xmlMap = new int[count];
                        }
                        _xmlMap[i] = SqlXml; // track its xml data
                    }
                    else if (typeof(System.Xml.XmlReader).IsAssignableFrom(fieldType)) {
                        fieldType = typeof(String); // map to DataColumn with DataType=typeof(string)
                        if (null == _xmlMap) {
                            _xmlMap = new int[count];
                        }
                        _xmlMap[i] = XmlDocument; // track its xml data
                    }

                    DataColumn dataColumn;
                    if (alwaysCreateColumns) {
                        dataColumn = DataColumnMapping.CreateDataColumnBySchemaAction(_fieldNames[i], _fieldNames[i], _dataTable, fieldType, schemaAction);
                    }
                    else {
                        dataColumn = _tableMapping.GetDataColumn(_fieldNames[i], fieldType, _dataTable, mappingAction, schemaAction);
                    }

                    if (null == dataColumn) {
                        if (null == columnIndexMap) {
                            columnIndexMap = CreateIndexMap(count, i);
                        }
                        columnIndexMap[i] = -1;
                        continue; // null means ignore (mapped to nothing)
                    }
                    else if ((null != _xmlMap) && (0 != _xmlMap[i])) {
                        if (typeof(System.Data.SqlTypes.SqlXml) == dataColumn.DataType) {
                            _xmlMap[i] = SqlXml;
                        }
                        else if (typeof(System.Xml.XmlDocument) == dataColumn.DataType) {
                            _xmlMap[i] = XmlDocument;
                        }
                        else {
                            _xmlMap[i] = 0; // datacolumn is not a specific Xml dataType, i.e. string

                            int total = 0;
                            for(int x = 0; x < _xmlMap.Length; ++x) {
                                total += _xmlMap[x];
                            }
                            if (0 == total) { // not mapping to a specific Xml datatype, get rid of the map
                                _xmlMap = null;
                            }
                        }
                    }

                    if (null == dataColumn.Table) {
                        if (ischapter) {
                            dataColumn.AllowDBNull = false;
                            dataColumn.AutoIncrement = true;
                            dataColumn.ReadOnly = true;
                        }
                        AddItemToAllowRollback(ref addedItems, dataColumn);
                        columnCollection.Add(dataColumn);
                    }
                    else if (ischapter && !dataColumn.AutoIncrement) {
                        throw ADP.FillChapterAutoIncrement();
                    }


                    if (null != columnIndexMap) {
                        columnIndexMap[i] = dataColumn.Ordinal;
                    }
                    else if (i != dataColumn.Ordinal) {
                        columnIndexMap = CreateIndexMap(count, i);
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:SchemaMapping.cs


示例14: CreateMergerInvoker

        static Object CreateMergerInvoker(DataTable target, bool preserveChanges, MissingSchemaAction action)
        {

            return null;
        }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:5,代码来源:FeatureMerger.cs


示例15: SetupSchemaWithoutKeyInfo

 private object[] SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, bool gettingData, DataColumn parentChapterColumn, object chapterValue)
 {
     int[] numArray = null;
     bool[] flagArray = null;
     int num3 = 0;
     int fieldCount = this._dataReader.FieldCount;
     object[] objArray = null;
     List<object> items = null;
     try
     {
         DataColumnCollection columnCollection = this._dataTable.Columns;
         for (int i = 0; i < fieldCount; i++)
         {
             bool flag = false;
             Type fieldType = this._dataReader.GetFieldType(i);
             if (null == fieldType)
             {
                 throw ADP.MissingDataReaderFieldType(i);
             }
             if (typeof(IDataReader).IsAssignableFrom(fieldType))
             {
                 if (flagArray == null)
                 {
                     flagArray = new bool[fieldCount];
                 }
                 flagArray[i] = flag = true;
                 fieldType = typeof(int);
             }
             else if (typeof(System.Data.SqlTypes.SqlXml).IsAssignableFrom(fieldType))
             {
                 if (this._xmlMap == null)
                 {
                     this._xmlMap = new int[fieldCount];
                 }
                 this._xmlMap[i] = 1;
             }
             else if (typeof(XmlReader).IsAssignableFrom(fieldType))
             {
                 fieldType = typeof(string);
                 if (this._xmlMap == null)
                 {
                     this._xmlMap = new int[fieldCount];
                 }
                 this._xmlMap[i] = 2;
             }
             DataColumn column = this._tableMapping.GetDataColumn(this._fieldNames[i], fieldType, this._dataTable, mappingAction, schemaAction);
             if (column == null)
             {
                 if (numArray == null)
                 {
                     numArray = this.CreateIndexMap(fieldCount, i);
                 }
                 numArray[i] = -1;
             }
             else
             {
                 if ((this._xmlMap != null) && (this._xmlMap[i] != 0))
                 {
                     if (typeof(System.Data.SqlTypes.SqlXml) == column.DataType)
                     {
                         this._xmlMap[i] = 1;
                     }
                     else if (typeof(System.Xml.XmlDocument) == column.DataType)
                     {
                         this._xmlMap[i] = 2;
                     }
                     else
                     {
                         this._xmlMap[i] = 0;
                         int num5 = 0;
                         for (int j = 0; j < this._xmlMap.Length; j++)
                         {
                             num5 += this._xmlMap[j];
                         }
                         if (num5 == 0)
                         {
                             this._xmlMap = null;
                         }
                     }
                 }
                 if (column.Table == null)
                 {
                     if (flag)
                     {
                         column.AllowDBNull = false;
                         column.AutoIncrement = true;
                         column.ReadOnly = true;
                     }
                     this.AddItemToAllowRollback(ref items, column);
                     columnCollection.Add(column);
                 }
                 else if (flag && !column.AutoIncrement)
                 {
                     throw ADP.FillChapterAutoIncrement();
                 }
                 if (numArray != null)
                 {
                     numArray[i] = column.Ordinal;
                 }
                 else if (i != column.Ordinal)
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SchemaMapping.cs


示例16: SetupSchemaWithKeyInfo

        private object[] SetupSchemaWithKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, bool gettingData, DataColumn parentChapterColumn, object chapterValue)
        {
            DbSchemaRow[] sortedSchemaRows = DbSchemaRow.GetSortedSchemaRows(this._schemaTable, this._dataReader.ReturnProviderSpecificTypes);
            if (sortedSchemaRows.Length == 0)
            {
                this._dataTable = null;
                return null;
            }
            bool flag = (this._dataTable.PrimaryKey.Length == 0 && this._dataTable.Rows.Count == 0) || 0 == this._dataTable.Columns.Count;
            DataColumn[] array = null;
            int num = 0;
            bool flag2 = true;
            string text = null;
            string text2 = null;
            bool flag3 = false;
            bool flag4 = false;
            int[] array2 = null;
            bool[] array3 = null;
            int num2 = 0;
            object[] result = null;
            List<object> items = null;
            DataColumnCollection columns = this._dataTable.Columns;
            try
            {
                for (int i = 0; i < sortedSchemaRows.Length; i++)
                {
                    DbSchemaRow dbSchemaRow = sortedSchemaRows[i];
                    int unsortedIndex = dbSchemaRow.UnsortedIndex;
                    bool flag5 = false;
                    Type type = dbSchemaRow.DataType;
                    if (null == type)
                    {
                        type = this._dataReader.GetFieldType(i);
                    }
                    if (null == type)
                    {
                        throw new Exception("MissingDataReaderFieldType");
                    }
                    if (typeof(IDataReader).IsAssignableFrom(type))
                    {
                        if (array3 == null)
                        {
                            array3 = new bool[sortedSchemaRows.Length];
                        }
                        flag5 = (array3[unsortedIndex] = true);
                        type = typeof(int);
                    }
                    else
                    {
                        if (typeof(SqlXml).IsAssignableFrom(type))
                        {
                            if (this._xmlMap == null)
                            {
                                this._xmlMap = new int[sortedSchemaRows.Length];
                            }
                            this._xmlMap[i] = 1;
                        }
                        else
                        {
                            if (typeof(XmlReader).IsAssignableFrom(type))
                            {
                                type = typeof(string);
                                if (this._xmlMap == null)
                                {
                                    this._xmlMap = new int[sortedSchemaRows.Length];
                                }
                                this._xmlMap[i] = 2;
                            }
                        }
                    }
                    DataColumn dataColumn = null;
                    if (!dbSchemaRow.IsHidden)
                    {
                        dataColumn = this._tableMapping.GetDataColumn(this._fieldNames[i], type, this._dataTable, mappingAction, schemaAction);
                    }
                    string baseTableName = dbSchemaRow.BaseTableName;
                    if (dataColumn == null)
                    {
                        if (array2 == null)
                        {
                            array2 = this.CreateIndexMap(sortedSchemaRows.Length, unsortedIndex);
                        }
                        array2[unsortedIndex] = -1;
                        if (dbSchemaRow.IsKey && (flag3 || dbSchemaRow.BaseTableName == text))
                        {
                            flag = false;
                            array = null;
                        }
                    }
                    else
                    {
                        if (this._xmlMap != null && this._xmlMap[i] != 0)
                        {
                            if (typeof(SqlXml) == dataColumn.DataType)
                            {
                                this._xmlMap[i] = 1;
                            }
                            else
                            {
                                if (typeof(XmlDocument) == dataColumn.DataType)
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:R106,代码行数:101,代码来源:SchemeMap.cs


示例17: SetupSchemaWithoutKeyInfo

 private object[] SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, bool gettingData, DataColumn parentChapterColumn, object chapterValue)
 {
     int[] array = null;
     bool[] array2 = null;
     int num = 0;
     int fieldCount = this._dataReader.FieldCount;
     object[] result = null;
     List<object> items = null;
     try
     {
         DataColumnCollection columns = this._dataTable.Columns;
         bool flag = this._dataTable.Columns.Count == 0 && (this._tableMapping.ColumnMappings == null || this._tableMapping.ColumnMappings.Count == 0) && mappingAction == MissingMappingAction.Passthrough;
         for (int i = 0; i < fieldCount; i++)
         {
             bool flag2 = false;
             Type type = this._dataReader.GetFieldType(i);
             if (null == type)
             {
                 throw new Exception("MissingDataReaderFieldType");
             }
             if (typeof(IDataReader).IsAssignableFrom(type))
             {
                 if (array2 == null)
                 {
                     array2 = new bool[fieldCount];
                 }
                 flag2 = (array2[i] = true);
                 type = typeof(int);
             }
             else
             {
                 if (typeof(SqlXml).IsAssignableFrom(type))
                 {
                     if (this._xmlMap == null)
                     {
                         this._xmlMap = new int[fieldCount];
                     }
                     this._xmlMap[i] = 1;
                 }
                 else
                 {
                     if (typeof(XmlReader).IsAssignableFrom(type))
                     {
                         type = typeof(string);
                         if (this._xmlMap == null)
                         {
                             this._xmlMap = new int[fieldCount];
                         }
                         this._xmlMap[i] = 2;
                     }
                 }
             }
             DataColumn dataColumn;
             if (flag)
             {
                 dataColumn = CreateDataColumnBySchemaAction(this._fieldNames[i], this._fieldNames[i], this._dataTable, type, schemaAction);
             }
             else
             {
                 dataColumn = this._tableMapping.GetDataColumn(this._fieldNames[i], type, this._dataTable, mappingAction, schemaAction);
             }
             if (dataColumn == null)
             {
                 if (array == null)
                 {
                     array = this.CreateIndexMap(fieldCount, i);
                 }
                 array[i] = -1;
             }
             else
             {
                 if (this._xmlMap != null && this._xmlMap[i] != 0)
                 {
                     if (typeof(SqlXml) == dataColumn.DataType)
                     {
                         this._xmlMap[i] = 1;
                     }
                     else
                     {
                         if (typeof(XmlDocument) == dataColumn.DataType)
                         {
                             this._xmlMap[i] = 2;
                         }
                         else
                         {
                             this._xmlMap[i] = 0;
                             int num2 = 0;
                             for (int j = 0; j < this._xmlMap.Length; j++)
                             {
                                 num2 += this._xmlMap[j];
                             }
                             if (num2 == 0)
                             {
                                 this._xmlMap = null;
                             }
                         }
                     }
                 }
                 if (dataColumn.Table == null)
                 {
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:R106,代码行数:101,代码来源:SchemeMap.cs


示例18: Merge

 /// <summary>
 ///     Merge the specified <see cref="T:System.Data.DataTable"/> with the current DataTable, indicating whether to preserve changes and 
 ///     how to handle missing schema in the current DataTable.
 /// </summary>
 /// <param name="table">
 ///     The <see cref="T:System.Data.DataTable"/> to be merged with the current <see cref="T:System.Data.DataTable"/>.
 /// </param>
 /// <param name="preserveChanges">
 ///     true, to preserve changes in the current <see cref="T:System.Data.DataTable"/>; otherwise false.
 /// </param>
 /// <param name="missingSchemaAction">
 ///     One of the <see cref="T:System.Data.MissingSchemaAction"/> values.
 /// </param>
 public void Merge(DataTable table,
                   bool preserveChanges,
                   MissingSchemaAction missingSchemaAction)
 {
     this.DataTableInstance.Merge(table, preserveChanges, missingSchemaAction);
 }
开发者ID:YannBrulhart,项目名称:SystemWrapper-1,代码行数:19,代码来源:DataTableWrap.cs


示例19: IsLegalSchemaAction

		private static bool IsLegalSchemaAction (MissingSchemaAction missingSchemaAction)
		{
			if (missingSchemaAction == MissingSchemaAction.Add || missingSchemaAction == MissingSchemaAction.AddWithKey
				|| missingSchemaAction == MissingSchemaAction.Error || missingSchemaAction == MissingSchemaAction.Ignore)
				return true;
			return false;
		}
开发者ID:t-ashula,项目名称:mono,代码行数:7,代码来源:DataSet.cs


示例20: GetDataColumn


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mission类代码示例发布时间:2022-05-24
下一篇:
C# MissileClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap