ISEbd-21.Fedotov.I.A.LabWork08 #8
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user