我想一個C#代碼轉換成VB代碼:找不到使用VB.NET的AddOrUpdate()方法?
在C#代碼它可以調用AddOrUpdate方法,但是當我在VB代碼它它不是在智能感知找到。
C#代碼:
protected override void Seed(eManager.Web.Infrastructure.DepartmentDB context){
context.Departments.AddOrUpdate(d => d.Name,
new Department() { Name = "Engineering"},
new Department() { Name = "Sales"}
);
}
VB代碼:
但是,當我的代碼VB的方法AddOrUpdate(),我找不到它。 DepartmentDB類的聲明是這樣的:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Data.Entity
Imports eManager.Domain
Public Class DepartmentDB
Inherits DbContext
Implements IDepartmentDataSource
Private _DBEmployees As DbSet(Of Employee)
Private _DBDepartments As DbSet(Of Department)
Public ReadOnly Property Departments As IQueryable(Of Department) Implements IDepartmentDataSource.Departments
Get
Return _DBDepartments
End Get
End Property
Public ReadOnly Property Employees As IQueryable(Of Employee) Implements IDepartmentDataSource.Employees
Get
Return _DBEmployees
End Get
End Property
End Class
在我看來,你的圖書館,或解決方案,是不是建築的另一部分,這只是一個該症狀。 –
@DominicKexel,你正在那裏,'進口'可能不存在;它是什麼名字空間? –