Currently i'am using a OData v4 third party server that uses Media object with OData. I automatically created the client code using the Unchase.Odata.Connectedservice Which runs fine but there are two things happening that seems to not work properly
Namespace violation: For the use of StreamContent there is a entry added in the Metadata:
Namespace System.Net.Http
'''<summary>
'''There are no comments for StreamContent in the schema.
'''</summary>
Partial Public Class StreamContent
'''<summary>
'''There are no comments for Property Headers in the schema.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.7.0")> _
Public Property Headers() As Global.System.Collections.ObjectModel.Collection(Of System.Collections.Generic.KeyValuePair_2OfString_IEnumerable_1OfString)
Get
Return Me._Headers
End Get
Set
Me.OnHeadersChanging(value)
Me._Headers = value
Me.OnHeadersChanged
End Set
End Property
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.7.0")> _
Private _Headers As Global.System.Collections.ObjectModel.Collection(Of System.Collections.Generic.KeyValuePair_2OfString_IEnumerable_1OfString) = New Global.System.Collections.ObjectModel.Collection(Of System.Collections.Generic.KeyValuePair_2OfString_IEnumerable_1OfString)()
Partial Private Sub OnHeadersChanging(ByVal value As Global.System.Collections.ObjectModel.Collection(Of System.Collections.Generic.KeyValuePair_2OfString_IEnumerable_1OfString))
End Sub
Partial Private Sub OnHeadersChanged()
End Sub
End Class
End Namespace
Now because the Namespace is called System.Net.Http it causes a namespace violation, breaking alot of this offcourse. So my question here, should it be an inherits/overload of the class System.Net.Http? Or how do i handle this?
If i remove/ignore the above generated code and the solution use the default System.Net.Http Namespace then i get errors during serialisation:
Execute, Message: An error occurred while processing this request.
InnerExceptionMessage: The response payload is a not a valid response payload. Please make sure that the top level element is a valid Atom or JSON element or belongs to 'http://docs.oasis-open.org/odata/ns/data' namespace.
Hi, @TripleNico
The VB code generation development has not evolved since I started contributing to OdataConnectedService.
You can open the same issue in microsoft repository instead of this.
Currently i'am using a OData v4 third party server that uses Media object with OData. I automatically created the client code using the
Unchase.Odata.Connectedservice
Which runs fine but there are two things happening that seems to not work properlyThat generates in this VB.NET code:
Now because the Namespace is called
System.Net.Http
it causes a namespace violation, breaking alot of this offcourse. So my question here, should it be an inherits/overload of the classSystem.Net.Http
? Or how do i handle this?System.Net.Http
Namespace then i get errors during serialisation:This is the response of the server: