我们目前在WPF应用程序上遇到架构问题.它涉及EntityFramework上下文管理,它实例化一次并在应用程序的整个生命周期中使用.因此,我们最终会遇到缓存问题,实体在加载一次时不会更新.使用该应用程序时,我们的实体已过时.
这是当前架构的架构.

[Export(typeof(OrderViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class OrderViewModel : ViewModelBase
{
private readonly IOrderManagementService _orderManagementService;
private readonly IOrderReadOnlyRepository _orderReadOnlyRepository;
[ImportingConstructor]
public OrderViewModel(IOrderManagementService orderManagementService, IOrderReadOnlyRepository orderReadOnlyRepository)
{
_orderManagementService = orderManagementService;
_orderReadOnlyRepository = orderReadOnlyRepository;
}
}
Run Code Online (Sandbox Code Playgroud)
public class OrderManagementService : IOrderManagementService
{
private readonly IUnitOfWork _unitOfWork;
private readonly IOrderManagementBusiness _orderManagementBusiness; …Run Code Online (Sandbox Code Playgroud)