zoukankan      html  css  js  c++  java
  • 调用存储过程返回复杂类型

    好久的问题了,被Microsoft 误导了一回,总算搞定了

    [Silverlight 4]+[Domainservice]

    1,建立好实体框架模型EDM,单击Get Column Information生成新的复杂类型

    2,在Your metadata 文件增加复杂类型的定义
    <MetadataTypeAttribute(GetType(TestSP_Result.TestSP_ResultMetadata))> _
    Partial Public Class TestSP_Result
        Friend NotInheritable Class TestSP_ResultMetadata
            Private Sub New()
                MyBase.New()
            End Sub

            Public Property address As String

            Public Property age As Nullable(Of Integer)

            Public Property [Class] As String

            <Key()>
            Public Property Name As String

            Public Property Score As Nullable(Of Decimal)

            Public Property Gender As String

            Public Property [Sum] As Nullable(Of Decimal)
        End Class

    End Class

    3,在your domainservice 文件增加调用方法
    #Region "SP"
        Public Function GetTestSP(ByVal gender As String, ByVal address As String) As ObjectResult(Of TestSP_Result)
            Return Me.ObjectContext.TestSP_Fun(gender, address)
        End Function
    #End Region

    4,打完收工。。。

    由于不知道的原因,需要我们手工去增加一些代码,,,后来的,,,可要注意了

  • 相关阅读:
    继承中类的作用域
    访问控制与继承
    虚函数与抽象基类
    定义基类和派生类
    类成员指针
    固有的不可移植特性
    局部类
    union
    嵌套类
    枚举类型
  • 原文地址:https://www.cnblogs.com/youfan/p/2009517.html
Copyright © 2011-2022 走看看