【问题标题】:Couldn't load stored procedure through Silverlight and RIA无法通过 Silverlight 和 RIA 加载存储过程
【发布时间】:2011-11-14 06:20:09
【问题描述】:

我想将返回值转储到 silverlight 应用程序的数据网格中。我写了一个没有键的存储过程,只返回 4 个属性。我已使用

将该函数导入实体框架
  • 函数导入名称 :: LecAllInfo
  • 存储过程名称 :: LecAllInfo
  • 返回 :: Complex : LecAllInfo_Result 的集合
  • 存储过程列信息

    StartTime, EndTime, Venue, Purpose
    

我的域服务类 (OrganizationService.cs) 中的代码

    public IQueryable<LecAllInfo_Result> LecAllInfoQuery(string lecId)
    {
        return this.ObjectContext.LecAllInfo(lecId).AsQueryable<LecAllInfo_Result>();
    }

我的元数据中的代码 (OrganizationService.metadata.cs)

[MetadataTypeAttribute(typeof(LecAllInfo_Result.LecAllInfo_ResultMetadata))]
public partial class LecAllInfo_Result
{
    internal sealed class LecAllInfo_ResultMetadata
     {
          private LecAllInfo_ResultMetadata()
          {
          }

          public DateTime StartTime { get; set; }
          public DateTime EndTime { get; set; }
          public string Venue { get; set; }
          public string Purpose { get; set; }
     }
}

但是我没有以通常的方式回调 LecAllInfo,即 ::

var context = new OrganizationContext();
context.Load(context.GetLecNotificationQuery(((App) Application.Current).GloUid), loadLectNort, null);
context.Load(context.Lec << Unable to Load it

context.Load(context.LecAllInfo("LP123112"), true);

将返回错误并重新提示 我在 'OrganizationContext.LecAllInfo' 中创建方法

我可以知道我的代码结构有问题吗?或者我不知道如何制作它时如何编辑它??

当我单击 resharper 选项时,它会在 SolutionName.Web.g.cs 中创建它

    public EntityQuery<object> LecAllInfo(string lp123112)
    {
        throw new NotImplementedException();
    }

我遵循了网络上的几个教程,stackoverflow 成员也发布了,但仍然没有这样做。谢谢回复

【问题讨论】:

  • @marc_s,您知道导致从客户端调用查询失败的问题在哪里吗??

标签: c# silverlight stored-procedures domainservices objectcontext


【解决方案1】:

加载存储过程应该定义任何作为返回的键。解决了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    相关资源
    最近更新 更多