0

我创建了一个 LINQ to EF 模型(用作 mvvm wpf 应用程序中的模型),但每个表的类不包含 on[columnname]changed 或 on[columnname]change 方法。我认为这些是由框架自动生成的。我想添加一些我自己的公共部分方法,以创建一些数据验证,如下页所示:http: //blogs.msdn.com/b/bethmassi/archive/2009/07/07/implementing-验证在 wpf-on-entity-framework-entities.aspx

以下类是 EF 自动生成的代码示例。

 Imports System
 Imports System.Collections.Generic

Partial Public Class client
Public Property idClient As Integer
Public Property chrFirst As String
Public Property chrLast As String
Public Property chrCompany As String
Public Property chrEmail As String
Public Property chrPhone1 As String
Public Property chrPhone1Ext As String
Public Property chrPhone2 As String
Public Property chrPhone2Ext As String
Public Property chrFax As String
Public Property chrSuite As String
Public Property chrAddess As String
Public Property chrCity As String
Public Property chrProvince As String
Public Property chrCountry As String
Public Property chrPostal As String
Public Property dtCreated As Nullable(Of Date)
Public Property dtUpdated As Nullable(Of Date)
Public Property FTC_Type As Nullable(Of Byte)

Public Overridable Property invoices As ICollection(Of invoice) = New HashSet(Of invoice)
Public Overridable Property jobs As ICollection(Of job) = New HashSet(Of job)

 End Class

当我添加同名的部分公共类时,我可以在 Visual Studio 窗口右上角的声明下拉列表中看到 EF 生成的原始类的所有声明。

1- LINQ to EF 是否以这种方式工作?2-我正在使用 vb.net 4 和 Visual Studio 2012,还有其他方法吗?

提前致谢

4

1 回答 1

1

您使用哪个模板来生成文件?

跟踪实体最适合在客户端/服务器 WPF 应用程序中使用,因为它们实现INotifyPropertyChanged并允许断开连接(n 层)更改跟踪。

于 2013-01-18T16:10:33.633 回答