返回复杂类型 [英] Return complex types

查看:119
本文介绍了返回复杂类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读过数据服务可以从服务操作返回复杂类型。我的数据服务基于实体模型。当我执行以下操作时,我收到一条错误消息,指出数据服务只能返回实体或基元类型。结果,搜索结果< WebGet()> _
Public Function GetTest()As IQueryable(Of TestObject)
Dim lst As New List(Of TestObject)
Dim obj1 As New TestObject
obj1.TestID = 1
lst.Add( obj1)
返回lst.AsQueryable
结束函数

公共类TestObject

私有_TestID作为整数
公共属性TestID()作为整数


返回_TestID
结束获取

(ByVal值为整数)
_TestID = value
结束集





>
End Class

I have read that data services can return complex types from services operations. My data service is based on an entity model. When I do the following I get an error saying the data service can only return entities or primitives types.


 <WebGet()> _
    Public Function GetTest() As IQueryable(Of TestObject)
        Dim lst As New List(Of TestObject)
        Dim obj1 As New TestObject
        obj1.TestID = 1
        lst.Add(obj1)
        Return lst.AsQueryable
    End Function




Public Class TestObject

    Private _TestID As Integer
    Public Property TestID() As Integer
        Get
            Return _TestID
        End Get
        Set(ByVal value As Integer)
            _TestID = value
        End Set
    End Property



End Class

推荐答案

否不,我们不告诉你答案,你必须支付这种支持
No no we dont tell you the answer, you have to pay for this kind of support


这篇关于返回复杂类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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