public static void ImportCsv <T, TList>(string configFile, string tableId, string importId, string sourceFile, TList successList, TList failList, bool withEvents, SourceDataValidatingHandler <DataRow, DataTable> sourceDataVilidater = null, DataValidatingHandler <T, TList> targetDataValidater = null) where T : class, new() where TList : class { CSVImport <T, TList> import = CreateCsvImport <T, TList>(configFile, tableId, importId, withEvents, sourceDataVilidater, targetDataValidater); import.Import(sourceFile, successList, failList); import.Dispose(); }
private static CSVImport <T, TList> CreateCsvImport <T, TList>(string configFile, string tableId, string importId, bool withEvents, SourceDataValidatingHandler <DataRow, DataTable> sourceDataVilidater = null, DataValidatingHandler <T, TList> targetDataValidater = null) where T : class, new() where TList : class { CSVImport <T, TList> import = new CSVImport <T, TList>(configFile, tableId); import.ImportId = importId; if (withEvents) { if (sourceDataVilidater != null) { import.SourceDataValidating += sourceDataVilidater; } if (targetDataValidater != null) { import.TargetDataValidating += targetDataValidater; } } return(import); }