private static void SetSqlIo(string tableName, XlsIo xlsIo, SqlIo sqlIo) { SetIdentityInsert(tableName, sqlIo, identityInsert: true); xlsIo.XlsSheet.ForEach(xlsRow => sqlIo.AddSqlStatement(SqlStatement(tableName, xlsIo, xlsRow))); SetIdentityInsert(tableName, sqlIo, identityInsert: false); }
private static void SetIdentityInsert(string tableName, SqlIo sqlIo, bool identityInsert) { if (Def.ExistsTable(tableName, o => o.Identity)) { sqlIo.SqlContainer.SqlStatementCollection.Add( new SqlStatement("set identity_insert [" + tableName + "]" + (identityInsert ? " on;" : " off;"))); } }