【发布时间】:2018-03-13 09:47:23
【问题描述】:
我已使用 EF6 访问数据库并从名为 Asset 的表中检索 DbSet 实体 (DbSet<Asset> Assets)。
表的行存储在为 WPF Xaml GUI 提供 DataContext 的 CollectionViewSource (CollectionViewSource x:Key="assetViewSource") 中。
GUI 的字段代表表格的列,它们绑定到assetViewSource 中的字段,如下所示:
Text="{Binding Path=AssetCategory, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
一切正常,用户可以通过 GUI 与数据库交互。
谁能告诉我如何从后面的代码中访问 assetViewSource 集合中的字段中的数据,这些数据已从 GUI 更新后但在更改保存到 RMS_DB 数据库之前?
我希望能够在后面的代码中做一些事情,如下所示:
codebehindField = assetViewSource.Asset.AssetCategory.
【问题讨论】:
标签: c# .net wpf entity-framework