/// <summary> /// Clears the user tables. /// </summary> /// <param name="postfix">The postfix.</param> public void ClearUserTables(string postfix) { var tableList = new List <string> { TableNameHelper.GetHostVisitCountTableName(postfix), TableNameHelper.GetHostVisitCountHourlyTableName(postfix), TableNameHelper.GetLocationAndUserDemoTableName(postfix), TableNameHelper.GetNewsHourlyTableName(postfix), TableNameHelper.GetNewsSentimentTableName(postfix), TableNameHelper.GetNewsStreamTableName(postfix), TableNameHelper.GetSentimentResultNewsTableName(postfix), TableNameHelper.GetSentimentResultTableName(postfix), TableNameHelper.GetWordCloudTableName(postfix) }; using (var db = ContextFactory.GetProfileContext()) { var sb = new StringBuilder(); foreach (var table in tableList) { sb.AppendLine($"Truncate Table {table};"); } db.Database.CommandTimeout = 300; try { db.Database.ExecuteSqlCommand(sb.ToString()); }catch (Exception e) { } } repository.CleanUserDataLoadHistory(postfix); }