using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service;
using SlnMesnac.WPF;
using SlnMesnac.WPF.Page;
using System;
using System.Collections.Generic;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本:4.0.30319.42000
* 机器名称:LAPTOP-E0N2L34V
* 命名空间:SlnMesnac.Model.dto
* 唯一标识:96940a51-66a8-4593-b68d-e4d7fdb16c9b
*
* 创建者:WenJY
* 电子邮箱:wenjy@mesnac.com
* 创建时间:2024-04-12 11:07:33
* 版本:V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本:V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.WPF.Model
{
///
/// 配方管理封装对象
///
public class RecipeManageCache
{
#region 单例实现
private static readonly RecipeManageCache lazy = new RecipeManageCache();
public static RecipeManageCache Instance
{
get
{
return lazy;
}
}
#endregion
#region 变量定义
private readonly ILogger _logger;
private readonly IBaseRecipeManageService? baseRecipeManageService;
public List recipeManageList = null;
#endregion
public RecipeManageCache()
{
baseRecipeManageService = App.ServiceProvider.GetService();
recipeManageList = baseRecipeManageService.GetRecipeManageList();
}
///
/// 更新配方
///
///
public void UpdateRecipeManage(RecipeManage recipeManage)
{
try
{
baseRecipeManageService.UpdateRecipeManage(recipeManage);
//刷新缓存
recipeManageList = baseRecipeManageService.GetRecipeManageList();
}
catch (Exception ex)
{
_logger.LogError($"UpdateRecipeManage异常:{ex.Message}");
}
}
}
}