0
我的程序有一个实体调用Articles
。在一种形式中,用户可以指定他想要购买多少新文章。这发生在一个称为“采购订单”的表单中。所以,当这种情况发生时,股票麝香会增加。在另一种形式中,我列出所有文章,它必须反映这种变化。提交事务后不刷新数据C#
现在,这是我的问题。在生成采购订单后,如果我转到SQL并在数据库中搜索该文章,我可以看到更改。如果转到我的表单上,我列出了文章,我无法看到这种变化。但是,如果我关闭该程序,然后再运行一次,如果搜索该文章,则会显示更改。
我不知道可能是什么错误。我正在使用实体框架。
这是我如何添加文章。
BaseRepository.BeginTransaction();
foreach (Documento_Articulo doc in datos.Documento_Articulo)
{
if (!articuloRepository.Increase(doc.Articulo.Id_Articulo, doc.Cantidad))
{
BaseRepository.RollBackTransaction();
return response.Error("Error: - " + doc.Articulo.Descripcion);
}
}
response.Value = documentoRepository.InsertGetDocument(datos);
BaseRepository.CommitTransaction();
我认为代码没有问题,因为正如我所说,我可以看到数据库中的更改。
有谁知道为什么会发生这种情况?
您是否在代码中刷新了您的列表? –
nope,我的功能回退列表,我显示它 – Coeus