ISEbd-21.Fedotov.I.A.LabWork08 #8

Closed
Ilfedotov.01 wants to merge 5 commits from ISEbd-21.Fedotov.I.A.LabWork08 into ISEbd-21.Fedotov.I.A.LabWork07
2 changed files with 5 additions and 4 deletions
Showing only changes of commit 03b8907a2f - Show all commits

View File

@ -9,7 +9,6 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace DinerDataBaseImplement.Models
{

View File

@ -11,6 +11,7 @@ using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
@ -32,7 +33,7 @@ namespace DineryBusinessLogic.BusinessLogic {
}
try {
_logger.LogDebug("Clera folder");
_logger.LogDebug("Clear folder");
// зачистка папки и удаление старого архива
var dirInfo = new DirectoryInfo(model.FolderName);
if (dirInfo.Exists) {
@ -81,8 +82,9 @@ namespace DineryBusinessLogic.BusinessLogic {
if (records == null) {
_logger.LogWarning($"{typeof(T).Name} type get null list");
}
var jsonFormatter = new DataContractSerializer(typeof(List<T>));
using var fs = new FileStream(string.Format($"{folderName}/{typeof(T).Name}.json"), FileMode.OpenOrCreate);
var jsonFormatter = new DataContractJsonSerializer(typeof(List<T>));
using var fs = new FileStream(string.Format("{0}/{1}.json", folderName, typeof(T).Name), FileMode.OpenOrCreate);
jsonFormatter.WriteObject(fs, records);
}
}