создание файлового хранилища сущностей

This commit is contained in:
bekodeg 2024-02-27 14:27:20 +04:00
parent b441884b40
commit f5603aee2e

View File

@ -27,8 +27,8 @@ namespace SushiBarFileImplement
private DataFileSingleton() private DataFileSingleton()
{ {
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
Sushis = LoadData(SushiFileName, "Sushi", x => Sushi.Create(x)!)!; Sushis = LoadData(SushiFileName, "Product", x => Sushi.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = new List<Order>();
} }
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction) private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
{ {