| | |
| | | |
| | | namespace WIDESEAWCS_QuartzJob.Seed |
| | | { |
| | | /// <summary> |
| | | /// 映射QuartzJob数据库表 |
| | | /// </summary> |
| | | /// <param name="dbContext"></param> |
| | | /// <returns></returns> |
| | | public class QuartzJobCreateDataTabel |
| | | { |
| | | private static string SeedDataFolder = "WIDESEAWCS_DB.DBSeed.Json/{0}.tsv"; |
| | |
| | | else |
| | | dic[i].Add("CreateDate", DateTime.Now); |
| | | } |
| | | string str = $"SET IDENTITY_INSERT {t.Name} ON;"; |
| | | string str = ""; |
| | | if (DBContext.DbType == SqlSugar.DbType.SqlServer) |
| | | { |
| | | str += $"SET IDENTITY_INSERT {t.Name} ON;"; |
| | | |
| | | str += dbContext.Db.Insertable(dic).AS(t.Name).ToSqlString(); |
| | | str += dbContext.Db.Insertable(dic).AS(t.Name).ToSqlString(); |
| | | |
| | | str += ($"SET IDENTITY_INSERT {t.Name} OFF;"); |
| | | str += ($"SET IDENTITY_INSERT {t.Name} OFF;"); |
| | | |
| | | dbContext.Db.Ado.ExecuteCommand(str); |
| | | dbContext.Db.Ado.ExecuteCommand(str); |
| | | } |
| | | else |
| | | { |
| | | dbContext.Db.Insertable(dic).AS(t.Name).ExecuteCommand(); |
| | | } |
| | | |
| | | ConsoleHelper.WriteSuccessLine($"Table [{t.Name}] SeedData Added Successfully"); |
| | | } |