这是 Visual Basic 2010。提前感谢您的关注。我有一个使用 EF 5.0 从数据库自动生成的“客户”实体。我编写了一个新的“cCustomer”类,它继承自上述类。
我的想法是为客户类提供一些我自己的方法,同时从 EF 类继承属性。我真正想做的事情是以最直接的方式使用来自“客户”类对象的数据加载我的类的新对象,而无需显式每个属性。这可能吗?
前任:
Public Class cCustomer
Inherits customer
Public Sub load(ByVal ID As Integer)
Using db As New dbEntities
Dim FoundCustomer As customer = db.cosutmers.Find(ID)
'the next lines are the ones that I would LOVE to reduce to just one magic line. So what would be??
me.name = FoundCustomer.name
me.adress = FoundCustomer.adress
me.phone = FoundCustomer.phone
End Using
End Sub
End Class
谢谢!!!