I can't figure this out as I go through demos that seem to work. I have a WCF service I was trying to use Linq to SQL with. However, all I ever get is the error System.Data.Linq.Table cannot be serialized. So I started with my own class thinking I could build it back up until get the error. Problem is I get the error even trying to use an empty class. Just using the "As System.Linq.Table(Of xxx)" on my method gives me this error.
Type 'System.Data.Linq.Table`1[LinqADMRequest2b]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.Runtime.Serialization
Imports System.Collections.Generic
Imports Linq
<ServiceContract(Namespace:="")> _
<ServiceBehavior(IncludeExceptionDetailInFaults:=True)> _
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class ComplyTrackWCFService
_
Public Function GetTestRequests() As System.Data.Linq.Table(Of LinqADMRequest2b)
'Dim ct As New Linq2.ComplyTrackDataContext()
'Dim queryresults = ct.ADMRequests 'ct.ADMRequestGetListByUser("", "155")
'Return queryresults
End Function
End Class
<DataContract()> _
<Serializable()> _
Public Class LinqADMRequest2b
Implements ISerializable
Private _firstName As String
_
Public Property FirstName() As String
Get
Return _firstName
End Get
Set(ByVal Value As String)
_firstName = Value
End Set
End Property
Public Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements System.Runtime.Serialization.ISerializable.GetObjectData
End Sub
End Class
As you can see the GetTestRequests() doesn't do anything other then say it's going to return a System.Data.Linq.Table(Of LinqADMRequest2b)
I can't get the LinqADMRequest2b to serialize.
Type 'System.Data.Linq.Table`1[LinqADMRequest2b]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.