1
假設我有一個使用northwind數據庫的實體customer
。將函數添加到LINQ中的實體
如果我在partial class customer
下創建了功能GetCustomerByID
。我可以用Linq
查詢如
Dim q = From t in db.Customers where t.GetCustomerByID(my_parameter) Select T
如果我partial class dx_northwindDataContext
下創建的函數執行此功能。我可以通過執行此功能:
Dim result = db.GetCustomerByID(my_parameter)
自從我創建數據訪問層爲我的數據庫,不暴露我的所有功能,我所有的實體到db
變量。我正在尋找一種叫我的功能的方式,如:
Dim result = db.Customers.GetCustomerByID(my_parameter)
有沒有那樣做?
它就像一個魅力..謝謝。 –