简体   繁体   English

通过wpf和ef通过视图更新Sql

[英]Updating Sql , through a view via wpf and ef

Background 背景

  • I am starting a series of simple screens to display and update info in our ERP database. 我正在启动一系列简单的屏幕,以显示和更新我们ERP数据库中的信息。

  • I have worked through the wpf controls and understand the need for Observable Collections and after reading around on Entity Framework I understand the advantages of it sitting on top of ADO.net compared to the basic SQL methods and Datatables I am more comfortable with due to my SQL experience. 我研究了wpf控件并了解了对Observable Collections的需求,并且在阅读了Entity Framework之后,我了解了它比基于SQL的基本SQL方法和Datatables位于ADO.net之上的优势。 SQL经验。

  • When I tried EF when I was first started working with Data CRUD screens I struggled to get the Observable Collections I needed, but having read this walk through last night ( https://msdn.microsoft.com/en-us/data/jj574514.aspx ) and seen the notes for VS 2010 to edit EF code to get Observable Collections I think I want to try EF again. 当我刚开始使用Data CRUD屏幕时尝试EF时,我很难获得所需的Observable Collections,但是昨晚阅读了此教程( https://msdn.microsoft.com/zh-cn/data/jj574514 .aspx ),并查看了VS 2010编辑EF代码以获得Observable Collections的注释,我想我想再次尝试EF。

Question

  • My Data screen needs present information which has be combined from five tables and a couple of sub views to be meaningful to the user. 我的数据屏幕需要显示的信息,这些信息已从五个表格和几个子视图中合并而成,以对用户有意义。

  • Included in the dataview is a simple Y/N flag which comes from one of the five Datatables. 数据视图中包含一个简单的Y / N标志,该标志来自五个数据表之一。

  • Can the user update the Y/N flag through the view mapped to EF, displayed in WPF datagrid ? 用户可以通过WPF数据网格中显示的映射到EF的视图更新Y / N标志吗?

  • Or do I have to map all the base Datatables and sub views and recreate the view and Data Context in EF to allow the update to work? 还是我必须映射所有基本的数据表和子视图,然后在EF中重新创建视图和数据上下文,以使更新生效?

If it is the latter does any one know of any tutorials or walk through I can use on my test development to try EF please 如果是后者,任何人都不会知道任何教程,或者逐步进行,我可以在测试开发中使用它来尝试EF。

Thanks 谢谢

The user can update a field via the view mapped to EF, however it is a little bit more complicated. 用户可以通过映射到EF的视图来更新字段,但是它有些复杂。

For a single table mapped to EF, the update is done by EF automatically, for a view mapped to EF you need to define the update function in the mapping details. 对于映射到EF的单个表,更新由EF自动完成,对于映射到EF的视图,您需要在映射详细信息中定义更新功能。

在此处输入图片说明

The function would be in form of an SQL stored procedure mapped to EF. 该功能将采用映射到EF的SQL存储过程的形式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM