一个有趣的问题......我无法理解......
让我告诉你我的第一个:
'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)....中工作得很好....
提前致谢。
答案 0 :(得分:4)
您的ReportsOfficesEntities
课程说Partial Class ReportsOfficesEntities
而非Public Class ReportsOfficesEntities
。那是什么原因吗?