date类型在序列化XML时找不到 RRS feed

  • 问题

  • 先根据XSD文件,用xsd.exe生成类,再对其中的属性进行赋值,但在最终生成的XML文档中找不到相应的属性.


        <System.Xml.Serialization.XmlElementAttribute(IsNullable:=True)> _
        Public Property ETDAirportDate() As System.Nullable(Of Date)
                Return Me.eTDAirportDateField
            End Get
            Set(ByVal value As System.Nullable(Of Date))
                Me.eTDAirportDateField = value
            End Set
        End Property


        <WebMethod()> _
        Public Function GetString(ByVal HawbNo As String) As AirAWB
            Dim Awb = New AirAWB
            Dim db = New AirDatabaseDataContext(PublicClass.GetConnectString("FwdSha"))
            Dim AEHBill = _
                From AEH In db.AirExpHouse _
                Join AE In db.AirExp On AEH.ExpID Equals AE.ID _
                Join U In db.Users On AE.CRTUserID Equals U.ID Where (AEH.HblNo = HawbNo) _
                Select AEH, AE, U.LoginName
            If AEHBill IsNot Nothing Then
                Dim Bill = AEHBill.First()
                With Awb
                    .CreateDate = Bill.AE.CRTTime
                    .AWBNumber = Bill.AEH.HblNo
                    .ETDAirportDate = New Date(Now.Year, Now.Month, Now.Day)
                    .ChargeableWeight = Bill.AEH.ChargeableWT
                    .AmountOfInsurance = Bill.AEH.InsuranceAmount
                    .ActivityTypeCode = AirAWBActivityTypeCode.HA
                    .GrossWeight = Single.Parse(Bill.AEH.GrossWT)
                    .CreateUser = Bill.LoginName
                    .ETDAirportDate1Specified = False
                End With
            End If
            Return Awb
        End Function


    2013年7月9日 8:47