Runtime v2.0.50727
I am getting the correct entity that I want.
OwnerEntity has many PropertyEntity. I am prefetching my PropertyEntityCollection when I get my OwnerEntityCollection on the webservice.
I write the xml from the OwnerEntity Collection on the webservice.
On the client I have a collection of OwnerEntity type. I read in the xml there and that is where i get the casting error.
When I stopped prefetching the PropertyEntityCollection on the webservice and just returned the OwnerEntityCollection everything worked.
It has something to do with my prefetch. Here is the code for that.
Dim Sellers As New EntityCollection(Of OwnerEntity)
Dim Prefetch As IPrefetchPath2 = New PrefetchPath2(CInt(EntityType.OwnerEntity))
Prefetch.Add(OwnerEntity.PrefetchPathPropertyLead)
Using adapter As New DataAccessAdapter
adapter.ConnectionString = Connection
adapter.FetchEntityCollection(Sellers, Nothing, Prefetch)
adapter.CloseConnection()
End Using
Prefetch = Nothing
Return Sellers
It works when I take out the prefetch.
Thomas