ReportsOfficesEntities

ReportsOfficesEntities

一个有趣的问题...我听不懂..

让我告诉你我首先拥有的:

'D:\ReportsOfficesSystem\ReportsOfficesBLL\BaseController.vb'
         ^                      ^                ^
     solution                 project         a vb class file




'D:\ReportsOfficesSystem\ReportsOfficesDAL\ReportsOfficesEntities.vb'
          ^                     ^                     ^
     the same solution         an other project       a vb class file


ReportsOfficesEntities.vb中:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Web
Namespace ReportsOfficesModel
    Partial Class ReportsOfficesEntities
        Public Shared ReadOnly Property db() As ReportsOfficesEntities
            Get
                If HttpContext.Current IsNot Nothing Then
                    If HttpContext.Current.Session("context") Is Nothing Then
                        HttpContext.Current.Session.Add("context", New ReportsOfficesEntities())
                    End If
                    Return TryCast(HttpContext.Current.Session("context"), ReportsOfficesEntities)
                Else
                    Return New ReportsOfficesEntities()
                End If
            End Get
        End Property
    End Class
End Namespace


BaseController.vb中:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports ReportsOfficesDAL.ReportsOfficesModel
Imports System.Web
Namespace ReportsOfficesBLL
    Public Class BaseController
        Protected db As ReportsOfficesEntities = ReportsOfficesEntities.db
        Protected MultiEntity As Boolean = False
        Public Sub Save()
            db.SaveChanges()
        End Sub
        Public Sub Rollback(ByVal entity As [Object])
            db.Refresh(System.Data.Objects.RefreshMode.StoreWins, entity)
        End Sub
    End Class
End Namespace


当然我也添加了两个项目的参考...

BaseController.vb中的错误:

'ReportsOfficesDAL.ReportsOfficesModel.ReportsOfficesEntities' is not accessible in this context because it is 'Friend'.


我检查了整个代码..想知道如果我错过了什么...什么!

搜索->

1:也许是小玩意儿...我不知道

2:我不确定是否是同样的问题..而且对我来说看起来很复杂。

注意:我从C#.net项目复制(转换)该文件,并且在(C#.net)中工作正常。

提前致谢。

最佳答案

您的ReportsOfficesEntities类说的是Partial Class ReportsOfficesEntities而不是Public Class ReportsOfficesEntities。那是原因吗?

08-03 22:42