IndexOf() public méthode

public IndexOf ( object value ) : int
value object
Résultat int
Exemple #1
0
        public static DataTableMapping GetTableMappingBySchemaAction(DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
        {
            if (null != tableMappings)
            {
                int index = tableMappings.IndexOf(sourceTable);
                if (-1 != index)
                {
                    return(tableMappings._items[index]);
                }
            }
            if (string.IsNullOrEmpty(sourceTable))
            {
                throw ADP.InvalidSourceTable(nameof(sourceTable));
            }
            switch (mappingAction)
            {
            case MissingMappingAction.Passthrough:
                return(new DataTableMapping(sourceTable, dataSetTable));

            case MissingMappingAction.Ignore:
                return(null);

            case MissingMappingAction.Error:
                throw ADP.MissingTableMapping(sourceTable);

            default:
                throw ADP.InvalidMissingMappingAction(mappingAction);
            }
        }
        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]   // MDAC 69508
        static public DataTableMapping GetTableMappingBySchemaAction(DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
        {
            if (null != tableMappings)
            {
                int index = tableMappings.IndexOf(sourceTable);
                if (-1 != index)
                {
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceWarning)
                    {
                        Debug.WriteLine("mapping match on SourceTable \"" + sourceTable + "\"");
                    }
#endif
                    return((DataTableMapping)tableMappings.items[index]);
                }
            }
            if (ADP.IsEmpty(sourceTable))
            {
                throw ADP.InvalidSourceTable("sourceTable");
            }
            switch (mappingAction)
            {
            case MissingMappingAction.Passthrough:
#if DEBUG
                if (AdapterSwitches.DataSchema.TraceInfo)
                {
                    Debug.WriteLine("mapping passthrough of SourceTable \"" + sourceTable + "\" -> \"" + dataSetTable + "\"");
                }
#endif
                return(new DataTableMapping(sourceTable, dataSetTable));

            case MissingMappingAction.Ignore:
#if DEBUG
                if (AdapterSwitches.DataSchema.TraceWarning)
                {
                    Debug.WriteLine("mapping filter of SourceTable \"" + sourceTable + "\"");
                }
#endif
                return(null);

            case MissingMappingAction.Error:
#if DEBUG
                if (AdapterSwitches.DataSchema.TraceError)
                {
                    Debug.WriteLine("mapping error on SourceTable \"" + sourceTable + "\"");
                }
#endif
                throw ADP.MissingTableMapping(sourceTable);

            default:
                throw ADP.InvalidMappingAction((int)mappingAction);
            }
        }
        [ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] // MDAC 69508
        static public DataTableMapping GetTableMappingBySchemaAction(DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction) {
            if (null != tableMappings) {
                int index = tableMappings.IndexOf(sourceTable);
                if (-1 != index) {
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceWarning) {
                        Debug.WriteLine("mapping match on SourceTable \"" + sourceTable + "\"");
                    }
#endif
                    return tableMappings.items[index];
                }
            }
            if (ADP.IsEmpty(sourceTable)) {
                throw ADP.InvalidSourceTable("sourceTable");
            }
            switch (mappingAction) {
                case MissingMappingAction.Passthrough:
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceInfo) {
                        Debug.WriteLine("mapping passthrough of SourceTable \"" + sourceTable + "\" -> \"" + dataSetTable + "\"");
                    }
#endif
                    return new DataTableMapping(sourceTable, dataSetTable);

                case MissingMappingAction.Ignore:
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceWarning) {
                        Debug.WriteLine("mapping filter of SourceTable \"" + sourceTable + "\"");
                    }
#endif
                    return null;

                case MissingMappingAction.Error:
#if DEBUG
                    if (AdapterSwitches.DataSchema.TraceError) {
                        Debug.WriteLine("mapping error on SourceTable \"" + sourceTable + "\"");
                    }
#endif
                    throw ADP.MissingTableMapping(sourceTable);

                default:
                    throw ADP.InvalidMissingMappingAction(mappingAction);
            }
        }