| 12345678910111213141516171819202122232425 |
- using WePlatform.EF;
- namespace WePlatform.SeedData
- {
- public static class ExecuteSql
- {
- public static void TruncateTable(this WePlatformDbContext context, string tableName)
- {
- if (string.IsNullOrEmpty(tableName))
- {
- return;
- }
- var sql = $"TRUNCATE TABLE {tableName}";
- context.Sql(sql);
- }
- public static void Sql(this WePlatformDbContext context, string sql)
- {
- if (string.IsNullOrEmpty(sql))
- {
- return;
- }
- context.Database.ExecuteSqlCommand(sql);
- }
- }
- }
|