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

使用存储过程从EF4返回嵌套的复杂类型

  •  0
  • Fermin  · 技术社区  · 14 年前

    是否可以使用EF从多个不同的存储过程返回嵌套的复杂类型?(例如ClientSelect、clientaddress select)

    我已经导入了一些存储过程,添加了函数导入,并为每个返回类型创建了一个复杂类型。(例如客户和客户地址)。

    尝试运行ClientSelect时,出现以下错误:

    "Nested ComplexType property 'ClientAddresses' in the ReturnType 'Client' of the function 'myModel.ClientSelect' is not supported, please consider flattening the nested ComplexType property."
    

    2 回复  |  直到 14 年前
        2
  •  0
  •   Fermin    14 年前

    using System.ServiceModel.DomainServices.Server;
    using System.ComponentModel.DataAnnotations;
    
    public partial class Client
    {
      [Include]
      [Association("Client_Address", "ClientAddressID", "ClientAddressID")]
      public IEnumerable<ClientAddress> Addresses { get; set; }
    }
    

    然后我调用一个SP来填充客户机,然后调用一个单独的存储过程来填充客户地址