WCF RIA服务未显示在添加数据源向导中 [英] WCF RIA Service not showing in Add Data Source Wizard

查看:60
本文介绍了WCF RIA服务未显示在添加数据源向导中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用VS2012时所经历的步骤,所以它是LS2,而我发现的几乎每个线程或博客文章都是LS1.

Steps I've been through USING VS2012, so it's LS2 and just about every thread or blog post I've found is LS1.

  1. 添加LS项目.  构建.  其中没有任何内容.
  2. 添加类库项目.  根据 Michael的教程 -我从标题创建A WCF RIA服务"开始关注.到添加名为WCF_RIA_Service的域服务类".
  3. 我在那里停了下来,切换到"从WCF RIA中的存储过程中提取数据 Silverlight服务"; " 将域服务类添加到Web项目 "中的文章;到目前为止,这是我发现成功的唯一方法 显示强制性的实体类型,并允许我在遵循Microsoft支持问题的指示后生成元数据: 某些实体框架上下文类可能已被排除"添加新的域服务类时出现一条消息.
  4. 我添加了自定义代码,以从列表存储过程中检索一组复杂类型;
  5. 构建良好,因此回到LS Project,使用消费WCF RIA服务"中的说明添加WCF RIA数据源. 迈克尔的 教程.长时间暂停后,向导类别列表为空!我的参考绝对是bin \ Debug \ WCF_RIA_Project.dll(我使用Michael的名字是因为它更容易跟随弹跳球...).
  1. Add LS Project.  Build.  There's nothing in it yet.
  2. Add Class Library Project.  Delete the class1.cs file per Michael's tutorial - I followed this from the heading "Create A WCF RIA Service" through to "Add a Domain Service Class called WCF_RIA_Service."
  3. I stopped there and switched to the "Pulling Data from Stored Procedures in WCF RIA Services for Silverlight" article from the "Add a Domain Service Class to the Web Project" paragraph onwards as it has, to-date, been the only way I've found to successfully show the mandatory Entity Type and allow me to generate the metadata AFTER following Microsoft Support's directives for the issue: "Some Entity Framework context classes may have been excluded" message when adding a new Domain Service Class.
  4. I added my custom code to retrieve a set of Complex Types from the List Stored Procedure; code shown below.
  5. Build is good, so back to the LS Project to add the WCF RIA Data Source, using directions from the "Consume The WCF RIA Service" paragraph from Michael's tutorial.  After a LONG pause, the Wizard classes list is empty!  My reference is definitely to the bin\Debug\WCF_RIA_Project.dll (I used Michael's names as it's easier to follow the bouncing ball...).

这就是我的困扰-没有服务...

And that's where I'm stuck - no Services...

有人可以告诉我我哪里出问题了吗?  

Can someone show me where I went wrong, please?  

(由于其他问题和我一直关注的兔子足迹,这是我第十次从头开始创建新项目")

(This is my tenth "start from scratch with new projects", due to other issues and rabbit trails I've followed...)

谢谢.

我的整个WCF_RIA_Service.cs文件,用最少的自定义内容填充:

My entire WCF_RIA_Service.cs file, replete with minimal customizations:

namespace WCF_RIA_Project
{
   using System;
   using System.Collections.Generic;
   using System.ComponentModel;
   using System.ComponentModel.DataAnnotations;
   using System.Data;
   using System.Linq;
   using System.ServiceModel.DomainServices.EntityFramework;
   using System.ServiceModel.DomainServices.Hosting;
   using System.ServiceModel.DomainServices.Server;
   // Implements application logic using the xcp_refEntities context.
   // TODO: Add your application logic to these methods or in additional methods.
   // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
   // Also consider adding roles to restrict access as appropriate.
   // [RequiresAuthentication]
   [EnableClientAccess()]
   public class WCF_RIA_Service : LinqToEntitiesDomainService<xcp_refEntities>
   {
      [Query( IsDefault = true )]
      public IQueryable<usp_GetSiteListForDropdownAllCompanies_Result> usp_GetSiteListForDropdownAllCompanies()
      {
         return this.ObjectContext.usp_GetSiteListForDropdownAllCompanies( false, false ).AsQueryable();
         //          return this.Context.usp_GetSiteListForDropdownAllCompanies( IncludeTerminatedSites, IncludeAllCompanies ).AsQueryable();
      }
      public IQueryable<usp_GetSiteListForDropdownAllCompanies_Result> usp_GetSiteListForDropdownAllCompanies( bool IncludeTerminatedSites, bool IncludeAllCompanies )
      {
         return this.ObjectContext.usp_GetSiteListForDropdownAllCompanies( IncludeTerminatedSites, IncludeAllCompanies ).AsQueryable();
      }
      // TODO:
      // Consider constraining the results of your query method.  If you need additional input you can
      // add parameters to this method or create additional query methods with different names.
      // To support paging you will need to add ordering to the 't_site_def' query.
      public IQueryable<t_site_def> GetT_site_def()
      {
         return this.ObjectContext.t_site_def;
      }
   }
   public class Site
   {
      [Key]
      public int site_Id { get; set; }
      public string site_name { get; set; }
      public DateTime site_launch_date { get; set; }
      public DateTime TerminationDate { get; set; }
   }
}

推荐答案

与V1相比,在LS V2中创建RIA服务的唯一区别是您将链接文件添加到了 Server 项目,而不是 ServerGenerated 项目.

The only difference between creating a RIA service in LS V2, compared to V1, is that you add the linked file to the Server project, instead of the ServerGenerated project.

有时候,当人们从V1升级到V2时,&按照有关如何为LightSwitch创建RIA服务的文章进行操作,是否仍将链接文件添加到 ServerGenerated 项目,因为该项目实际上仍然存在.但是在V2中 ServerGenerated 项目,&可以安全地删除 ClientGenerated 项目,因为不再使用它们了(它们不再包含在解决方案中,因此当您切换到该项目时,您将不会看到它们 文件视图,但是添加链接后您仍然可以导航到它们.

Sometimes, when people upgrade from V1 to V2, & follow the articles on how to create a RIA service for LightSwitch, is they still add the linked file to the ServerGenerated project because the project actually still exists. But in V2 the ServerGenerated project, & the ClientGenerated project can safely be deleted, as they're not used any more (they're no longer "included" in the solution, so you won't see them when you switch to File View, but you can still navigate to them when adding the link).

您可能会问然后,如果不使用它们,为什么它们还在那里?".我的猜测是,团队在谨慎方面犯了错误,不想惊动升级后发现项目丢失的人.我个人认为 最好删除它们,但这只是我的意见.

You might ask "then why are they still there, if they're not being used?". My guess is that the team were erring on the side of caution, not wanting to alarm people who found that project's were missing after the upgrade. Personally I think it would have been better to delete them, but that's just my opinion.

我不知道您的项目是否已从V1升级.除此之外,我想不出其他任何区别.

I don't know if your project was upgraded from V1, or not. Apart from that, I can't think of any other difference.


这篇关于WCF RIA服务未显示在添加数据源向导中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆