2011-03-28 51 views
2

我已经添加了我的域服务,但是当我构建我的Web项目时,DomainContext永远不会生成。我是RIA Services的新手,想要学习,但我很困惑。没有在RIA Service for Silverlight 4中生成DomainContext

这里是我的域名服务

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 
+0

您是否添加了RIA服务链接? [如何:添加或删除RIA服务链接](http://msdn.microsoft.com/en-us/library/ee707372(v = vs.91).aspx) – Kinnara 2011-03-28 20:41:09

+0

我去我的Silverlight项目属性下silverlight标签,并将WCF RIA Services链接设置为我的Wellness.Web,它是asp.net Web应用程序。这是我试图遵循的博客... http://msmvps.com/blogs/deborahk/archive/2009/11/05/silverlight-ria-services-and-your-business-objects.aspx?CommentPosted = true#commentmessage – Spafa9 2011-03-28 20:43:08

回答

0

也许Models.EventSchedule,那是你的IEnumerable基类,是您在Web项目中已经引用但不能在引用库客户端,因为它不是一个Silverlight库?

我认为这会阻止在客户端生成EventScheduleDataContext。

一个简单的测试是将IEnumerable的基础更改为Web项目中的类。

+0

我试图从这个使用普通类库的博客中使用示例,因为项目在多个应用程序中使用,所以我可以创建RIA服务类库。如果我无法确定probalby必须使用wcf服务来调用数据。 http://msmvps.com/blogs/deborahk/archive/2009/11/05/silverlight-ria-services-and-your-business-objects.aspx?CommentPosted=true#commentmessage – Spafa9 2011-03-29 12:02:28

+0

但是,如果我的建议做了一个简单的测试? – GilShalit 2011-03-29 16:59:18

0

我也有这个问题。我的问题是Visual Studio被设置为发布模式。将其设置为调试模式解决了它。

相关问题