simple-odata-client / Simple.OData.Client

MIT License
331 stars 197 forks source link

How to use standard aggregation method with query option $apply? #415

Open 0x7a68 opened 7 years ago

0x7a68 commented 7 years ago

Hi,

I want to make a query like this:

GET /b1s/v1/BusinessPartners?$apply=aggregate(CreditLimit with sum as TotalDocRate) HTTP/1.1

Since IFluentClient doesn't have a method Apply to execute such query, I tried to execute this query by basic API with a command text:

        public dynamic Sum()
        {
            var result = oDataClient
                .FindEntryAsync("BusinessPartners?$apply=aggregate(CreditLimit with sum as TotalCreditLimit)")
                .Result;          
            return result;
        }

The client sent an request and received expected response (could be seen in Fiddler):

{
   "odata.metadata" : "$metadata#BusinessPartners(TotalCreditLimit)",
   "value" : [
      {
         "odata.id" : null,
         "TotalCreditLimit" : 300.0
      }
   ]
}

However, the C# code raise an exception:

UriFormatException: Invalid URI: The format of the URI could not be determined.

I wonder what's wrong with the URI since the request has already be sent to server successfully.

BTW, I think it has something in common with #412 . Requests are sent to server successfully but the client still raises errors.

Thanks.

object commented 7 years ago

Can you send me the definition of BusinessPartners, ideally as it appears in the metadata (i.e. the extract from the metadata XML)?

0x7a68 commented 7 years ago

Hi, here it is:

<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
    <edmx:DataServices m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
        <Schema Namespace="SAPB1" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
             ...
            <EntityType Name="BusinessPartner">
                <Key>
                    <PropertyRef Name="CardCode"/>
                </Key>
                <Property Name="CardCode" Nullable="false" Type="Edm.String"/>
                <Property Name="CardName" Type="Edm.String"/>
                <Property Name="CardType" Type="Edm.String"/>
                <Property Name="GroupCode" Type="Edm.Int32"/>
                <Property Name="Address" Type="Edm.String"/>
                <Property Name="ZipCode" Type="Edm.String"/>
                <Property Name="MailAddress" Type="Edm.String"/>
                <Property Name="MailZipCode" Type="Edm.String"/>
                <Property Name="Phone1" Type="Edm.String"/>
                <Property Name="Phone2" Type="Edm.String"/>
                <Property Name="Fax" Type="Edm.String"/>
                <Property Name="ContactPerson" Type="Edm.String"/>
                <Property Name="Notes" Type="Edm.String"/>
                <Property Name="PayTermsGrpCode" Type="Edm.Int32"/>
                <Property Name="CreditLimit" Type="Edm.Double"/>
                <Property Name="MaxCommitment" Type="Edm.Double"/>
                <Property Name="DiscountPercent" Type="Edm.Double"/>
                <Property Name="VatLiable" Type="Edm.String"/>
                <Property Name="FederalTaxID" Type="Edm.String"/>
                <Property Name="DeductibleAtSource" Type="Edm.String"/>
                <Property Name="DeductionPercent" Type="Edm.Double"/>
                <Property Name="DeductionValidUntil" Type="Edm.DateTime"/>
                <Property Name="PriceListNum" Type="Edm.Int32"/>
                <Property Name="IntrestRatePercent" Type="Edm.Double"/>
                <Property Name="CommissionPercent" Type="Edm.Double"/>
                <Property Name="CommissionGroupCode" Type="Edm.Int32"/>
                <Property Name="FreeText" Type="Edm.String"/>
                <Property Name="SalesPersonCode" Type="Edm.Int32"/>
                <Property Name="Currency" Type="Edm.String"/>
                <Property Name="RateDiffAccount" Type="Edm.String"/>
                <Property Name="Cellular" Type="Edm.String"/>
                <Property Name="AvarageLate" Type="Edm.Int32"/>
                <Property Name="City" Type="Edm.String"/>
                <Property Name="County" Type="Edm.String"/>
                <Property Name="Country" Type="Edm.String"/>
                <Property Name="MailCity" Type="Edm.String"/>
                <Property Name="MailCounty" Type="Edm.String"/>
                <Property Name="MailCountry" Type="Edm.String"/>
                <Property Name="EmailAddress" Type="Edm.String"/>
                <Property Name="Picture" Type="Edm.String"/>
                <Property Name="DefaultAccount" Type="Edm.String"/>
                <Property Name="DefaultBranch" Type="Edm.String"/>
                <Property Name="DefaultBankCode" Type="Edm.String"/>
                <Property Name="AdditionalID" Type="Edm.String"/>
                <Property Name="Pager" Type="Edm.String"/>
                <Property Name="FatherCard" Type="Edm.String"/>
                <Property Name="CardForeignName" Type="Edm.String"/>
                <Property Name="FatherType" Type="Edm.String"/>
                <Property Name="DeductionOffice" Type="Edm.String"/>
                <Property Name="ExportCode" Type="Edm.String"/>
                <Property Name="MinIntrest" Type="Edm.Double"/>
                <Property Name="CurrentAccountBalance" Type="Edm.Double"/>
                <Property Name="OpenDeliveryNotesBalance" Type="Edm.Double"/>
                <Property Name="OpenOrdersBalance" Type="Edm.Double"/>
                <Property Name="VatGroup" Type="Edm.String"/>
                <Property Name="ShippingType" Type="Edm.Int32"/>
                <Property Name="Password" Type="Edm.String"/>
                <Property Name="Indicator" Type="Edm.String"/>
                <Property Name="IBAN" Type="Edm.String"/>
                <Property Name="CreditCardCode" Type="Edm.Int32"/>
                <Property Name="CreditCardNum" Type="Edm.String"/>
                <Property Name="CreditCardExpiration" Type="Edm.DateTime"/>
                <Property Name="DebitorAccount" Type="Edm.String"/>
                <Property Name="OpenOpportunities" Type="Edm.Int32"/>
                <Property Name="Valid" Type="Edm.String"/>
                <Property Name="ValidFrom" Type="Edm.DateTime"/>
                <Property Name="ValidTo" Type="Edm.DateTime"/>
                <Property Name="ValidRemarks" Type="Edm.String"/>
                <Property Name="Frozen" Type="Edm.String"/>
                <Property Name="FrozenFrom" Type="Edm.DateTime"/>
                <Property Name="FrozenTo" Type="Edm.DateTime"/>
                <Property Name="FrozenRemarks" Type="Edm.String"/>
                <Property Name="Block" Type="Edm.String"/>
                <Property Name="BillToState" Type="Edm.String"/>
                <Property Name="ExemptNum" Type="Edm.String"/>
                <Property Name="Priority" Type="Edm.Int32"/>
                <Property Name="FormCode1099" Type="Edm.Int32"/>
                <Property Name="Box1099" Type="Edm.String"/>
                <Property Name="PeymentMethodCode" Type="Edm.String"/>
                <Property Name="BackOrder" Type="Edm.String"/>
                <Property Name="PartialDelivery" Type="Edm.String"/>
                <Property Name="BlockDunning" Type="Edm.String"/>
                <Property Name="BankCountry" Type="Edm.String"/>
                <Property Name="HouseBank" Type="Edm.String"/>
                <Property Name="HouseBankCountry" Type="Edm.String"/>
                <Property Name="HouseBankAccount" Type="Edm.String"/>
                <Property Name="ShipToDefault" Type="Edm.String"/>
                <Property Name="DunningLevel" Type="Edm.Int32"/>
                <Property Name="DunningDate" Type="Edm.DateTime"/>
                <Property Name="CollectionAuthorization" Type="Edm.String"/>
                <Property Name="DME" Type="Edm.String"/>
                <Property Name="InstructionKey" Type="Edm.String"/>
                <Property Name="SinglePayment" Type="Edm.String"/>
                <Property Name="ISRBillerID" Type="Edm.String"/>
                <Property Name="PaymentBlock" Type="Edm.String"/>
                <Property Name="ReferenceDetails" Type="Edm.String"/>
                <Property Name="HouseBankBranch" Type="Edm.String"/>
                <Property Name="OwnerIDNumber" Type="Edm.String"/>
                <Property Name="PaymentBlockDescription" Type="Edm.Int32"/>
                <Property Name="TaxExemptionLetterNum" Type="Edm.String"/>
                <Property Name="MaxAmountOfExemption" Type="Edm.Double"/>
                <Property Name="ExemptionValidityDateFrom" Type="Edm.DateTime"/>
                <Property Name="ExemptionValidityDateTo" Type="Edm.DateTime"/>
                <Property Name="LinkedBusinessPartner" Type="Edm.String"/>
                <Property Name="LastMultiReconciliationNum" Type="Edm.Int32"/>
                <Property Name="DeferredTax" Type="Edm.String"/>
                <Property Name="Equalization" Type="Edm.String"/>
                <Property Name="SubjectToWithholdingTax" Type="Edm.String"/>
                <Property Name="CertificateNumber" Type="Edm.String"/>
                <Property Name="ExpirationDate" Type="Edm.DateTime"/>
                <Property Name="NationalInsuranceNum" Type="Edm.String"/>
                <Property Name="AccrualCriteria" Type="Edm.String"/>
                <Property Name="WTCode" Type="Edm.String"/>
                <Property Name="BillToBuildingFloorRoom" Type="Edm.String"/>
                <Property Name="DownPaymentClearAct" Type="Edm.String"/>
                <Property Name="ChannelBP" Type="Edm.String"/>
                <Property Name="DefaultTechnician" Type="Edm.Int32"/>
                <Property Name="BilltoDefault" Type="Edm.String"/>
                <Property Name="CustomerBillofExchangDisc" Type="Edm.String"/>
                <Property Name="Territory" Type="Edm.Int32"/>
                <Property Name="ShipToBuildingFloorRoom" Type="Edm.String"/>
                <Property Name="CustomerBillofExchangPres" Type="Edm.String"/>
                <Property Name="ProjectCode" Type="Edm.String"/>
                <Property Name="VatGroupLatinAmerica" Type="Edm.String"/>
                <Property Name="DunningTerm" Type="Edm.String"/>
                <Property Name="Website" Type="Edm.String"/>
                <Property Name="OtherReceivablePayable" Type="Edm.String"/>
                <Property Name="BillofExchangeonCollection" Type="Edm.String"/>
                <Property Name="CompanyPrivate" Type="Edm.String"/>
                <Property Name="LanguageCode" Type="Edm.Int32"/>
                <Property Name="UnpaidBillofExchange" Type="Edm.String"/>
                <Property Name="WithholdingTaxDeductionGroup" Type="Edm.Int32"/>
                <Property Name="ClosingDateProcedureNumber" Type="Edm.Int32"/>
                <Property Name="Profession" Type="Edm.String"/>
                <Property Name="BankChargesAllocationCode" Type="Edm.String"/>
                <Property Name="TaxRoundingRule" Type="Edm.String"/>
                <Property Name="Properties1" Type="Edm.String"/>
                <Property Name="Properties2" Type="Edm.String"/>
                <Property Name="Properties3" Type="Edm.String"/>
                <Property Name="Properties4" Type="Edm.String"/>
                <Property Name="Properties5" Type="Edm.String"/>
                <Property Name="Properties6" Type="Edm.String"/>
                <Property Name="Properties7" Type="Edm.String"/>
                <Property Name="Properties8" Type="Edm.String"/>
                <Property Name="Properties9" Type="Edm.String"/>
                <Property Name="Properties10" Type="Edm.String"/>
                <Property Name="Properties11" Type="Edm.String"/>
                <Property Name="Properties12" Type="Edm.String"/>
                <Property Name="Properties13" Type="Edm.String"/>
                <Property Name="Properties14" Type="Edm.String"/>
                <Property Name="Properties15" Type="Edm.String"/>
                <Property Name="Properties16" Type="Edm.String"/>
                <Property Name="Properties17" Type="Edm.String"/>
                <Property Name="Properties18" Type="Edm.String"/>
                <Property Name="Properties19" Type="Edm.String"/>
                <Property Name="Properties20" Type="Edm.String"/>
                <Property Name="Properties21" Type="Edm.String"/>
                <Property Name="Properties22" Type="Edm.String"/>
                <Property Name="Properties23" Type="Edm.String"/>
                <Property Name="Properties24" Type="Edm.String"/>
                <Property Name="Properties25" Type="Edm.String"/>
                <Property Name="Properties26" Type="Edm.String"/>
                <Property Name="Properties27" Type="Edm.String"/>
                <Property Name="Properties28" Type="Edm.String"/>
                <Property Name="Properties29" Type="Edm.String"/>
                <Property Name="Properties30" Type="Edm.String"/>
                <Property Name="Properties31" Type="Edm.String"/>
                <Property Name="Properties32" Type="Edm.String"/>
                <Property Name="Properties33" Type="Edm.String"/>
                <Property Name="Properties34" Type="Edm.String"/>
                <Property Name="Properties35" Type="Edm.String"/>
                <Property Name="Properties36" Type="Edm.String"/>
                <Property Name="Properties37" Type="Edm.String"/>
                <Property Name="Properties38" Type="Edm.String"/>
                <Property Name="Properties39" Type="Edm.String"/>
                <Property Name="Properties40" Type="Edm.String"/>
                <Property Name="Properties41" Type="Edm.String"/>
                <Property Name="Properties42" Type="Edm.String"/>
                <Property Name="Properties43" Type="Edm.String"/>
                <Property Name="Properties44" Type="Edm.String"/>
                <Property Name="Properties45" Type="Edm.String"/>
                <Property Name="Properties46" Type="Edm.String"/>
                <Property Name="Properties47" Type="Edm.String"/>
                <Property Name="Properties48" Type="Edm.String"/>
                <Property Name="Properties49" Type="Edm.String"/>
                <Property Name="Properties50" Type="Edm.String"/>
                <Property Name="Properties51" Type="Edm.String"/>
                <Property Name="Properties52" Type="Edm.String"/>
                <Property Name="Properties53" Type="Edm.String"/>
                <Property Name="Properties54" Type="Edm.String"/>
                <Property Name="Properties55" Type="Edm.String"/>
                <Property Name="Properties56" Type="Edm.String"/>
                <Property Name="Properties57" Type="Edm.String"/>
                <Property Name="Properties58" Type="Edm.String"/>
                <Property Name="Properties59" Type="Edm.String"/>
                <Property Name="Properties60" Type="Edm.String"/>
                <Property Name="Properties61" Type="Edm.String"/>
                <Property Name="Properties62" Type="Edm.String"/>
                <Property Name="Properties63" Type="Edm.String"/>
                <Property Name="Properties64" Type="Edm.String"/>
                <Property Name="CompanyRegistrationNumber" Type="Edm.String"/>
                <Property Name="VerificationNumber" Type="Edm.String"/>
                <Property Name="DiscountBaseObject" Type="Edm.String"/>
                <Property Name="DiscountRelations" Type="Edm.String"/>
                <Property Name="TypeReport" Type="Edm.String"/>
                <Property Name="ThresholdOverlook" Type="Edm.String"/>
                <Property Name="SurchargeOverlook" Type="Edm.String"/>
                <Property Name="DownPaymentInterimAccount" Type="Edm.String"/>
                <Property Name="OperationCode347" Type="Edm.String"/>
                <Property Name="InsuranceOperation347" Type="Edm.String"/>
                <Property Name="HierarchicalDeduction" Type="Edm.String"/>
                <Property Name="ShaamGroup" Type="Edm.String"/>
                <Property Name="WithholdingTaxCertified" Type="Edm.String"/>
                <Property Name="BookkeepingCertified" Type="Edm.String"/>
                <Property Name="PlanningGroup" Type="Edm.String"/>
                <Property Name="Affiliate" Type="Edm.String"/>
                <Property Name="Industry" Type="Edm.Int32"/>
                <Property Name="VatIDNum" Type="Edm.String"/>
                <Property Name="DatevAccount" Type="Edm.Int32"/>
                <Property Name="DatevFirstDataEntry" Type="Edm.String"/>
                <Property Name="GTSRegNo" Type="Edm.String"/>
                <Property Name="GTSBankAccountNo" Type="Edm.String"/>
                <Property Name="GTSBillingAddrTel" Type="Edm.String"/>
                <Property Name="ETaxWebSite" Type="Edm.Int32"/>
                <Property Name="HouseBankIBAN" Type="Edm.String"/>
                <Property Name="VATRegistrationNumber" Type="Edm.String"/>
                <Property Name="RepresentativeName" Type="Edm.String"/>
                <Property Name="IndustryType" Type="Edm.String"/>
                <Property Name="BusinessType" Type="Edm.String"/>
                <Property Name="Series" Type="Edm.Int32"/>
                <Property Name="AutomaticPosting" Type="Edm.String"/>
                <Property Name="InterestAccount" Type="Edm.String"/>
                <Property Name="FeeAccount" Type="Edm.String"/>
                <Property Name="CampaignNumber" Type="Edm.Int32"/>
                <Property Name="AliasName" Type="Edm.String"/>
                <Property Name="DefaultBlanketAgreementNumber" Type="Edm.Int32"/>
                <Property Name="EffectiveDiscount" Type="Edm.String"/>
                <Property Name="NoDiscounts" Type="Edm.String"/>
                <Property Name="GlobalLocationNumber" Type="Edm.String"/>
                <Property Name="EDISenderID" Type="Edm.String"/>
                <Property Name="EDIRecipientID" Type="Edm.String"/>
                <Property Name="ResidenNumber" Type="Edm.String"/>
                <Property Name="RelationshipCode" Type="Edm.String"/>
                <Property Name="RelationshipDateFrom" Type="Edm.DateTime"/>
                <Property Name="RelationshipDateTill" Type="Edm.DateTime"/>
                <Property Name="UnifiedFederalTaxID" Type="Edm.String"/>
                <Property Name="AttachmentEntry" Type="Edm.Int32"/>
                <Property Name="TypeOfOperation" Type="Edm.String"/>
                <Property Name="EndorsableChecksFromBP" Type="Edm.String"/>
                <Property Name="AcceptsEndorsedChecks" Type="Edm.String"/>
                <Property Name="OwnerCode" Type="Edm.Int32"/>
                <Property Name="BlockSendingMarketingContent" Type="Edm.String"/>
                <Property Name="AgentCode" Type="Edm.String"/>
                <Property Name="EDocGenerationType" Type="Edm.String"/>
                <Property Name="EDocStreet" Type="Edm.String"/>
                <Property Name="EDocStreetNumber" Type="Edm.String"/>
                <Property Name="EDocBuildingNumber" Type="Edm.Int32"/>
                <Property Name="EDocZipCode" Type="Edm.String"/>
                <Property Name="EDocCity" Type="Edm.String"/>
                <Property Name="EDocCountry" Type="Edm.String"/>
                <Property Name="EDocDistrict" Type="Edm.String"/>
                <Property Name="EDocRepresentativeFirstName" Type="Edm.String"/>
                <Property Name="EDocRepresentativeSurname" Type="Edm.String"/>
                <Property Name="EDocRepresentativeCompany" Type="Edm.String"/>
                <Property Name="EDocRepresentativeFiscalCode" Type="Edm.String"/>
                <Property Name="EDocRepresentativeAdditionalId" Type="Edm.String"/>
                <Property Name="EDocPECAddress" Type="Edm.String"/>
                <Property Name="IPACodeForPA" Type="Edm.String"/>
                <Property Name="UpdateDate" Type="Edm.DateTime"/>
                <Property Name="UpdateTime" Type="Edm.DateTime"/>
                <Property Name="ExemptionMaxAmountValidationType" Type="Edm.String"/>
                <Property Name="U_u1" Type="Edm.String"/>
                <Property Name="BPAddresses" Type="Collection(SAPB1.BPAddress)"/>
                <Property Name="ContactEmployees" Type="Collection(SAPB1.ContactEmployee)"/>
                <Property Name="BPAccountReceivablePaybleCollection" Type="Collection(SAPB1.BPAccountReceivablePayble)"/>
                <Property Name="BPPaymentMethods" Type="Collection(SAPB1.BPPaymentMethod)"/>
                <Property Name="BPWithholdingTaxCollection" Type="Collection(SAPB1.BPWithholdingTax)"/>
                <Property Name="BPPaymentDates" Type="Collection(SAPB1.BPPaymentDate)"/>
                <Property Name="BPBranchAssignment" Type="Collection(SAPB1.BPBranchAssignmentItem)"/>
                <Property Name="BPBankAccounts" Type="Collection(SAPB1.BPBankAccount)"/>
                <Property Name="BPFiscalTaxIDCollection" Type="Collection(SAPB1.BPFiscalTaxID)"/>
                <Property Name="DiscountGroups" Type="Collection(SAPB1.DiscountGroup)"/>
                <Property Name="BPIntrastatExtension" Type="SAPB1.BPIntrastatExtension"/>
                <Property Name="BPBlockSendingMarketingContents" Type="Collection(SAPB1.BPBlockSendingMarketingContent)"/>
                <NavigationProperty FromRole="BusinessPartners" Name="SalesOpportunities" Relationship="SAPB1.FK_SalesOpportunities_BusinessPartners" ToRole="SalesOpportunities"/>
                <NavigationProperty FromRole="BusinessPartners" Name="UserDefaultGroups" Relationship="SAPB1.FK_UserDefaultGroups_BusinessPartners" ToRole="UserDefaultGroups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="SpecialPrices" Relationship="SAPB1.FK_SpecialPrices_BusinessPartners" ToRole="SpecialPrices"/>
                <NavigationProperty FromRole="BusinessPartners" Name="LandedCosts" Relationship="SAPB1.FK_LandedCosts_BusinessPartners" ToRole="LandedCosts"/>
                <NavigationProperty FromRole="BusinessPartners" Name="WorkOrders" Relationship="SAPB1.FK_WorkOrders_BusinessPartners" ToRole="WorkOrders"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Warehouses" Relationship="SAPB1.FK_Warehouses_BusinessPartners" ToRole="Warehouses"/>
                <NavigationProperty FromRole="BusinessPartners" Name="InventoryGenEntries" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseQuotations" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BankPages" Relationship="SAPB1.FK_BankPages_BusinessPartners" ToRole="BankPages"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ProductionOrders" Relationship="SAPB1.FK_ProductionOrders_BusinessPartners" ToRole="ProductionOrders"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DepreciationAreas" Relationship="SAPB1.FK_DepreciationAreas_BusinessPartners" ToRole="DepreciationAreas"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DeliveryNotes" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BusinessPartnerGroup" Relationship="SAPB1.FK_BusinessPartners_BusinessPartnerGroups" ToRole="BusinessPartnerGroups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PaymentTermsType" Relationship="SAPB1.FK_BusinessPartners_PaymentTermsTypes" ToRole="PaymentTermsTypes"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PriceList" Relationship="SAPB1.FK_BusinessPartners_PriceLists" ToRole="PriceLists"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CommissionGroup" Relationship="SAPB1.FK_BusinessPartners_CommissionGroups" ToRole="CommissionGroups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="SalesPerson" Relationship="SAPB1.FK_BusinessPartners_SalesPersons" ToRole="SalesPersons"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Currency2" Relationship="SAPB1.FK_BusinessPartners_Currencies" ToRole="Currencies"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ChartOfAccount" Relationship="SAPB1.FK_BusinessPartners_ChartOfAccounts" ToRole="ChartOfAccounts"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Country2" Relationship="SAPB1.FK_BusinessPartners_Countries" ToRole="Countries"/>
                <NavigationProperty FromRole="BusinessPartners" Name="VatGroup2" Relationship="SAPB1.FK_BusinessPartners_VatGroups" ToRole="VatGroups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ShippingType2" Relationship="SAPB1.FK_BusinessPartners_ShippingTypes" ToRole="ShippingTypes"/>
                <NavigationProperty FromRole="BusinessPartners" Name="FactoringIndicator" Relationship="SAPB1.FK_BusinessPartners_FactoringIndicators" ToRole="FactoringIndicators"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CreditCard" Relationship="SAPB1.FK_BusinessPartners_CreditCards" ToRole="CreditCards"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BPPriority" Relationship="SAPB1.FK_BusinessPartners_BPPriorities" ToRole="BPPriorities"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Forms1099" Relationship="SAPB1.FK_BusinessPartners_Forms1099" ToRole="Forms1099"/>
                <NavigationProperty FromRole="BusinessPartners" Name="WizardPaymentMethod" Relationship="SAPB1.FK_BusinessPartners_WizardPaymentMethods" ToRole="WizardPaymentMethods"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DunningLetter" Relationship="SAPB1.FK_BusinessPartners_DunningLetters" ToRole="DunningLetters"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PaymentBlock2" Relationship="SAPB1.FK_BusinessPartners_PaymentBlocks" ToRole="PaymentBlocks"/>
                <NavigationProperty FromRole="BusinessPartners" Name="WithholdingTaxCode" Relationship="SAPB1.FK_BusinessPartners_WithholdingTaxCodes" ToRole="WithholdingTaxCodes"/>
                <NavigationProperty FromRole="BusinessPartners" Name="EmployeeInfo" Relationship="SAPB1.FK_BusinessPartners_EmployeesInfo" ToRole="EmployeesInfo"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Territory2" Relationship="SAPB1.FK_BusinessPartners_Territories" ToRole="Territories"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Project" Relationship="SAPB1.FK_BusinessPartners_Projects" ToRole="Projects"/>
                <NavigationProperty FromRole="BusinessPartners" Name="SalesTaxCode" Relationship="SAPB1.FK_BusinessPartners_SalesTaxCodes" ToRole="SalesTaxCodes"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DunningTerm2" Relationship="SAPB1.FK_BusinessPartners_DunningTerms" ToRole="DunningTerms"/>
                <NavigationProperty FromRole="BusinessPartners" Name="UserLanguage" Relationship="SAPB1.FK_BusinessPartners_UserLanguages" ToRole="UserLanguages"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DeductionTaxGroup" Relationship="SAPB1.FK_BusinessPartners_DeductionTaxGroups" ToRole="DeductionTaxGroups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BankChargesAllocationCode2" Relationship="SAPB1.FK_BusinessPartners_BankChargesAllocationCodes" ToRole="BankChargesAllocationCodes"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Industry2" Relationship="SAPB1.FK_BusinessPartners_Industries" ToRole="Industries"/>
                <NavigationProperty FromRole="BusinessPartners" Name="TaxWebSite" Relationship="SAPB1.FK_BusinessPartners_TaxWebSites" ToRole="TaxWebSites"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Campaign" Relationship="SAPB1.FK_BusinessPartners_Campaigns" ToRole="Campaigns"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BlanketAgreement" Relationship="SAPB1.FK_BusinessPartners_BlanketAgreements" ToRole="BlanketAgreements"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Quotations" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DeductionTaxHierarchies" Relationship="SAPB1.FK_DeductionTaxHierarchies_BusinessPartners" ToRole="DeductionTaxHierarchies"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ServiceContracts" Relationship="SAPB1.FK_ServiceContracts_BusinessPartners" ToRole="ServiceContracts"/>
                <NavigationProperty FromRole="BusinessPartners" Name="InventoryGenExits" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseRequests" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BlanketAgreements" Relationship="SAPB1.FK_BlanketAgreements_BusinessPartners" ToRole="BlanketAgreements"/>
                <NavigationProperty FromRole="BusinessPartners" Name="GLAccountAdvancedRules" Relationship="SAPB1.FK_GLAccountAdvancedRules_BusinessPartners" ToRole="GLAccountAdvancedRules"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseReturns" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Invoices" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CreditNotes" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="StockTransfers" Relationship="SAPB1.FK_StockTransfers_BusinessPartners" ToRole="StockTransfers"/>
                <NavigationProperty FromRole="BusinessPartners" Name="BusinessPlaces" Relationship="SAPB1.FK_BusinessPlaces_BusinessPartners" ToRole="BusinessPlaces"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Orders" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="DownPayments" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PartnersSetups" Relationship="SAPB1.FK_PartnersSetups_BusinessPartners" ToRole="PartnersSetups"/>
                <NavigationProperty FromRole="BusinessPartners" Name="EmployeesInfo" Relationship="SAPB1.FK_EmployeesInfo_BusinessPartners" ToRole="EmployeesInfo"/>
                <NavigationProperty FromRole="BusinessPartners" Name="InventoryTransferRequests" Relationship="SAPB1.FK_StockTransfers_BusinessPartners" ToRole="StockTransfers"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Activities" Relationship="SAPB1.FK_Activities_BusinessPartners" ToRole="Activities"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Drafts" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="StockTransferDrafts" Relationship="SAPB1.FK_StockTransfers_BusinessPartners" ToRole="StockTransfers"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Returns" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="MaterialRevaluation" Relationship="SAPB1.FK_MaterialRevaluation_BusinessPartners" ToRole="MaterialRevaluation"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CorrectionInvoiceReversal" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CorrectionPurchaseInvoice" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CorrectionPurchaseInvoiceReversal" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Items" Relationship="SAPB1.FK_Items_BusinessPartners" ToRole="Items"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CustomerEquipmentCards" Relationship="SAPB1.FK_CustomerEquipmentCards_BusinessPartners" ToRole="CustomerEquipmentCards"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseInvoices" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="Contacts" Relationship="SAPB1.FK_Contacts_BusinessPartners" ToRole="Contacts"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseDeliveryNotes" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="CorrectionInvoice" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseCreditNotes" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ServiceCalls" Relationship="SAPB1.FK_ServiceCalls_BusinessPartners" ToRole="ServiceCalls"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseDownPayments" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseOrders" Relationship="SAPB1.FK_Documents_BusinessPartners" ToRole="Documents"/>
                <NavigationProperty FromRole="BusinessPartners" Name="AlternateCatNum" Relationship="SAPB1.FK_AlternateCatNum_BusinessPartners" ToRole="AlternateCatNum"/>
                <NavigationProperty FromRole="BusinessPartners" Name="ProjectManagements" Relationship="SAPB1.FK_ProjectManagements_BusinessPartners" ToRole="ProjectManagements"/>
                <NavigationProperty FromRole="BusinessPartners" Name="SalesTaxInvoices" Relationship="SAPB1.FK_SalesTaxInvoices_BusinessPartners" ToRole="SalesTaxInvoices"/>
                <NavigationProperty FromRole="BusinessPartners" Name="PurchaseTaxInvoices" Relationship="SAPB1.FK_PurchaseTaxInvoices_BusinessPartners" ToRole="PurchaseTaxInvoices"/>
            </EntityType>
            ...
            <EntityContainer Name="ServiceLayer">
                ...
                <EntitySet EntityType="SAPB1.BusinessPartner" Name="BusinessPartners"/>
                ...
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>