Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetDataTableBySchemaAction()

DataTable? System.Data.Common.DataTableMapping.GetDataTableBySchemaAction ( DataSet dataSet,
MissingSchemaAction schemaAction )
inline

Definition at line 165 of file DataTableMapping.cs.

166 {
167 if (dataSet == null)
168 {
169 throw ADP.ArgumentNull("dataSet");
170 }
171 string dataSetTable = DataSetTable;
172 if (string.IsNullOrEmpty(dataSetTable))
173 {
174 return null;
175 }
176 DataTableCollection tables = dataSet.Tables;
177 int num = tables.IndexOf(dataSetTable);
178 if (0 <= num && num < tables.Count)
179 {
180 return tables[num];
181 }
182 switch (schemaAction)
183 {
184 case MissingSchemaAction.Add:
185 case MissingSchemaAction.AddWithKey:
186 return new DataTable(dataSetTable);
187 case MissingSchemaAction.Ignore:
188 return null;
189 case MissingSchemaAction.Error:
190 throw ADP.MissingTableSchema(dataSetTable, SourceTable);
191 default:
192 throw ADP.InvalidMissingSchemaAction(schemaAction);
193 }
194 }

References System.Data.DataTableCollection.Add(), System.Data.Common.ADP.ArgumentNull(), System.Data.InternalDataCollectionBase.Count, System.Data.Common.DataTableMapping.DataSetTable, System.Data.DataTableCollection.IndexOf(), System.Data.Common.ADP.InvalidMissingSchemaAction(), System.Data.Common.ADP.MissingTableSchema(), System.Data.Common.DataTableMapping.SourceTable, and System.Data.DataSet.Tables.

Referenced by System.Data.ProviderBase.SchemaMapping.SchemaMapping().