Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Microsoft.OData.XX instaed of Microsoft.Data.XX #410

Closed
DomSchmHopp opened this issue Aug 21, 2024 · 2 comments
Closed

Using Microsoft.OData.XX instaed of Microsoft.Data.XX #410

DomSchmHopp opened this issue Aug 21, 2024 · 2 comments

Comments

@DomSchmHopp
Copy link

DomSchmHopp commented Aug 21, 2024

Hi !
I have to develop an application which uses an OData service from SAP (R3).
But whenever I import the metadata file to the Odata Connected Service Importer I get proxy classes which use the deprecated Microsoft.Data.XX libraries (Version 5.8.5). The most of these libs are marked as deprecated.

Can anyone give me a hint how to change to the new Microsoft.OData.XX Libs (Version 8.0.1)?

This is the metadata.xml file I import:

<edmx:Edmx Version="1.0"
	xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
	xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
	xmlns:sap="http://www.sap.com/Protocols/SAPData">
	<edmx:DataServices m:DataServiceVersion="2.0">
		<Schema Namespace="ZPP_SERIALISIERUNG_ZW_SRV" xml:lang="en" sap:schema-version="1"
			xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
			<ComplexType Name="Component">
				<Property Name="ComponentNumber" Type="Edm.String" Nullable="false" MaxLength="18" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
				<Property Name="MaterialDescription" Type="Edm.String" MaxLength="40" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
				<Property Name="SerializationProfile" Type="Edm.String" MaxLength="4" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
				<Property Name="RequiredQuantity" Type="Edm.Decimal" Precision="13" Scale="3" sap:unit="RequiredQuantityUnit" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
				<Property Name="RequiredQuantityUnit" Type="Edm.String" MaxLength="3" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" sap:semantics="unit-of-measure"/>
			</ComplexType>
			<ComplexType Name="Equipment">
				<Property Name="EquipmentNumber" Type="Edm.String" Nullable="false" MaxLength="18" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
			</ComplexType>
			<EntityContainer Name="ZPP_SERIALISIERUNG_ZW_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
				<FunctionImport Name="getComponentsWithSerializationProfile" ReturnType="Collection(ZPP_SERIALISIERUNG_ZW_SRV.Component)" m:HttpMethod="GET">
					<Parameter Name="ProductionOrderNumber" Type="Edm.String" Mode="In" MaxLength="12"/>
				</FunctionImport>
				<FunctionImport Name="serialize" ReturnType="ZPP_SERIALISIERUNG_ZW_SRV.Equipment" m:HttpMethod="POST">
					<Parameter Name="MaterialNumbersComponents" Type="Edm.String" Mode="In"/>
					<Parameter Name="SerialNumber" Type="Edm.String" Mode="In" MaxLength="18"/>
					<Parameter Name="ProductionOrderNumber" Type="Edm.String" Mode="In" MaxLength="12"/>
					<Parameter Name="MaterialNumber" Type="Edm.String" Mode="In" MaxLength="18"/>
					<Parameter Name="SerialNumbersComponents" Type="Edm.String" Mode="In"/>
				</FunctionImport>
			</EntityContainer>
			<atom:link rel="self" href="http://URL:8000/sap/opu/odata/SAP/ZPP_SERIALISIERUNG_ZW_SRV/$metadata"
				xmlns:atom="http://www.w3.org/2005/Atom"/>
				<atom:link rel="latest-version" href="http://URL:8000/sap/opu/odata/SAP/ZPP_SERIALISIERUNG_ZW_SRV/$metadata"
					xmlns:atom="http://www.w3.org/2005/Atom"/>
				</Schema>
			</edmx:DataServices>
		</edmx:Edmx>

Any hint would be much appreciated because I don´t want to implement a new tool with outdated libs.

Dominik

@WanjohiSammy
Copy link

WanjohiSammy commented Aug 27, 2024

@DomSchmHopp Are those old versions of OData working for you as expected.

Also note that the CSDL that you are using is V2 and only works with the packages Microsoft.Data.XX. To have latest packages, opt to use V3 or V4

@habbes
Copy link
Contributor

habbes commented Sep 9, 2024

@WanjohiSammy @DomSchmHopp V3 also only works with System.Data.XX, to use Microsoft.OData.XX, you should be using a CSDL version v4 (4.0 or 4.01).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants