未在 Silverlight 4 的 RIA 服务中生成 DomainContext
我已经添加了域服务,但是当我构建 Web 项目时,DomainContext 永远不会生成。我是 RIA 服务的新手,正在尝试学习,但我真的陷入困境。
这是我的域服务
Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports Wellness.BL
Imports System.Collections.ObjectModel
'TODO: Create methods containing your application logic.
<EnableClientAccess()> _
Public Class EventScheduleService
Inherits DomainService
Public Function GetEventSchedule(ByVal ScheduleYear As Integer) As IEnumerable(Of Models.EventSchedule)
Return DataServices.EventSchedulesDataService.GetEventSchedule(ScheduleYear)
End Function
End Class
I have added my domain service but when I build my web project the DomainContext never gets generated. I am new to RIA Services and trying to learn but I am really stuck.
Here is my Domain Service
Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports Wellness.BL
Imports System.Collections.ObjectModel
'TODO: Create methods containing your application logic.
<EnableClientAccess()> _
Public Class EventScheduleService
Inherits DomainService
Public Function GetEventSchedule(ByVal ScheduleYear As Integer) As IEnumerable(Of Models.EventSchedule)
Return DataServices.EventSchedulesDataService.GetEventSchedule(ScheduleYear)
End Function
End Class
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许 Models.EventSchedule(作为 IEnumerable 基础的类)位于您在 Web 项目中引用的库中,但无法在客户端中引用,因为它不是 Silverlight 库?
我认为这会阻止在客户端中生成 EventScheduleDataContext。
一个简单的测试是将 IEnumerable 的基更改为 Web 项目中的类。
Maybe Models.EventSchedule, the class that is the base for your IEnumerable, is in a library that you have referenced in the Web project but can not be referenced in the client as it is not a Silverlight library?
I think that would prevent the EventScheduleDataContext from being generated in the client.
A simple test would be to change base of the IEnumerable to a class that lives in the Web project.
我也有这个问题。我的问题是 Visual Studio 设置为发布模式。将其设置为调试模式解决了它。
I had this problem also. My problem was that Visual Studio was set to Release mode. Setting it to Debug mode solved it.