未在 Silverlight 4 的 RIA 服务中生成 DomainContext

发布于 2024-10-27 08:25:56 字数 881 浏览 4 评论 0原文

我已经添加了域服务,但是当我构建 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沧桑㈠ 2024-11-03 08:25:56

也许 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.

跨年 2024-11-03 08:25:56

我也有这个问题。我的问题是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文