代码之家  ›  专栏  ›  技术社区  ›  Tim

Silverlight WCF访问返回LLBLGen实体的IList?

  •  0
  • Tim  · 技术社区  · 17 年前

    我在将实体集合从LLBLGen传递回silverlight时遇到问题。我的合同是这样的。我甚至不知道这是否可能。

    我的web服务代码如下所示:

    public IEnumerable<WaterWorksCustomersEntity> GetCustomer(long custId, string acctKey)
    {
        var toReturn = new WaterWorksCustomersEntity(custId, acctKey);
        using (var adapter = new DataAccessAdapter())
        {
            adapter.ConnectionString = "data source=CWCPROD.cwc.local;user.."; 
            adapter.FetchEntity(toReturn);
        }
        IList<WaterWorksCustomersEntity> customers = new List<WaterWorksCustomersEntity>();
        customers.Add(toReturn);
        return customers; 
    }
    

    在我的silverlight客户机上。。。

    var client = new Service1Client();
    client.GetCustomerCompleted += new EventHandler<GetCustomerCompletedEventArgs>(client_GetCustomerCompleted);
    client.GetCustomerAsync(2,"110865");
    

    编译失败,出现以下错误:

    错误1:命名空间中的“命名空间”的类型或命名空间名称“ArayOfXEngEnter”不存在(是否缺少程序集引用?)c: \work\Appointment\Appointment\AppointmentClientSL\Service服务 References\ServiceReference1\Reference.cs 63 54指定客户端

    看起来SL无法处理web服务返回的数据。

    有人能帮忙吗???

    2 回复  |  直到 15 年前
        1
  •  2
  •   Scrappydog    17 年前

    在LLBLGEN网站上有一个通过WCF调用LLBLGEN的示例: http://www.llblgen.com/pages/secure/ListDownloads.aspx?ProductVersion=6#6

    它通过netTcp进行同步调用,但可能有一些有用的线索。。。

        2
  •  0
  •   Frans Bouma    16 年前

    Silverlight是在不同的.NET框架上构建的,因此我们的实体类型不能在该平台上使用。如果要将我们的实体类发送到silverlight,请使用DTO类。我们的论坛有几个模板可以为您生成helper code+DTO类。搜索“DTO模板”。

    推荐文章