Я пытаюсь преобразовать код C# в VB код:Метод AddOrUpdate() не найден с использованием VB.NET?
В кодах C# можно назвать метод AddOrUpdate, но когда я его код в VB он не нашел в IntelliSense.
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, вы на что-то там, «Импорт», вероятно, не существует; в каком пространстве имён? –