DataFileSingleton
This commit is contained in:
parent
2f29c9b6bd
commit
ec7dc9e65a
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user