小编Cha*_*dhi的帖子

使用VB.NET找不到AddOrUpdate()方法?

我试图将C#代码转换为VB代码:

在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"}
         );
     }
Run Code Online (Sandbox Code Playgroud)

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 …
Run Code Online (Sandbox Code Playgroud)

c# vb.net iqueryable

0
推荐指数
1
解决办法
701
查看次数

标签 统计

c# ×1

iqueryable ×1

vb.net ×1