DataFileSingleton

This commit is contained in:
VictoriaPresnyakova 2023-02-19 21:10:27 +04:00
parent 2f29c9b6bd
commit ec7dc9e65a

View File

@ -29,14 +29,12 @@ namespace JewelryStoreFileImplement
"Components", x => x.GetXElement);
public void SaveProducts() => SaveData(Products, ProductFileName,
"Products", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x
=> x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
private DataFileSingleton()
{
Components = LoadData(ComponentFileName, "Component", x =>
Component.Create(x)!)!;
Products = LoadData(ProductFileName, "Product", x =>
Product.Create(x)!)!;
Products = LoadData(ProductFileName, "Product", x => Jewel.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
}
private static List<T>? LoadData<T>(string filename, string xmlNodeName,