Giter Site home page Giter Site logo

Comments (8)

unchase avatar unchase commented on June 4, 2024

Hello.
It is not a bug. You cannot use the "-" character in property naming. Just rename this on the server side and it will works.

from unchase.odata.connectedservice.

goedo avatar goedo commented on June 4, 2024

OK I see (and thank Nickolaj for your fast answer!) that there are hyphens in property names and this is illegal.
<xs:simpleType name="TSimpleIdentifier">
<xs:restriction base="xs:string">
<xs:maxLength value="480" />

<xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}" />
</xs:restriction>
</xs:simpleType>

My problem, however, is that this i a 3rd-party standard app which well works with powerpivot and others, so it will be hard to convince them to change the property names :-(
Thanks in the mean time; I will save the metadata locally, change the hyphen, and then see what happens when I connect to the odata feed...
Bye
Roger

from unchase.odata.connectedservice.

goedo avatar goedo commented on June 4, 2024

Help!
Even correcting the hyphen, it will not read my XML; for a test, I reduced it to the "Lieferanten" part, and then the tool gives me:

[11.11.2019 09:46:18.922] Unchase OData Connected Service wird dem Projekt hinzugefügt.
[11.11.2019 09:46:18.922] Adding service instance...
[11.11.2019 09:46:18.925] Adding Nuget Packages for OData V3...
[11.11.2019 09:46:18.933] Nuget Package "System.ValueTuple" for OData V3 already installed.
[11.11.2019 09:46:18.937] Nuget Package "System.ComponentModel.Annotations" for OData V3 already installed.
[11.11.2019 09:46:18.942] Nuget Package "Microsoft.Data.Services.Client" for OData V3 already installed.
[11.11.2019 09:46:18.947] Nuget Package "Microsoft.Data.OData" for OData V3 already installed.
[11.11.2019 09:46:18.951] Nuget Package "Microsoft.Data.Edm" for OData V3 already installed.
[11.11.2019 09:46:18.956] Nuget Package "System.Spatial" for OData V3 already installed.
[11.11.2019 09:46:18.958] Nuget Packages for OData V3 were installed.
[11.11.2019 09:46:18.961] Generating Client Proxy for OData V3...
[11.11.2019 09:46:19.023] Fehler:Fehler beim Hinzufügen von Unchase OData Connected Service zum Projekt: Das angegebene Schema ist ungültig. Fehler:
(0,0) : Fehler 0075: Schlüsselteil: 'PK_LieferantID' für Typ Lieferanten ist ungültig. Für sämtliche Teile des Schlüssels dürfen keine NULL-Werte zulässig sein.

Someone getting the same problem?
Thanks a lot!

from unchase.odata.connectedservice.

unchase avatar unchase commented on June 4, 2024

Looks like the edm-schema specified is not valid for OData validation into the generation library that used by the Connected Service. I try to comment some parts of the schema, but have some errors:

  1. "Name Zentralregulierer cannot be used in type Myfactory.Models.Zentralregulierer. Member names cannot be the same as their enclosing type." line: 1716

  2. There are a few "EntityType has no key defined. Define the key for this EntityType.":

  • 'Myfactory.Models.Projektbudgets'
  • 'Myfactory.Models.ArtikelZusatzartikel'
  • 'Myfactory.Models.Verkaufpreise'
  • 'Myfactory.Models.ArtikelVariantenDimensionswerte'
  • 'Myfactory.Models.EinkaufUmsatzdetails'
  • 'Myfactory.Models.VerkaufAuftragschancen'
  • 'Myfactory.Models.VerkaufAuftragseingang'
  • 'Myfactory.Models.VerkaufUmsatzdetails'
  • 'Myfactory.Models.VK_OffeneBelege'
  • 'Myfactory.Models.VerkaufBudgetArtikel'
  • 'Myfactory.Models.VerkaufBudgetArtikelgruppen'
  • 'Myfactory.Models.VerkaufBudgetBetriebsstaetten'
  • 'Myfactory.Models.VerkaufBudgetKunden'
  • 'Myfactory.Models.VerkaufBudgetKundengruppen'
  • 'Myfactory.Models.VerkaufBudgetVertreter'
  • 'Myfactory.Models.VerkaufBudgetVertretergruppen'
  • 'Myfactory.Models.SachkontoBudget'
  • 'Myfactory.Models.BuchungenKosten'
  • 'Myfactory.Models.ZeiteintraegeSpesen'
  • 'Myfactory.Models.Dispoeintraege'
  • 'Myfactory.Models.Lagerbestaende'
  • 'Myfactory.Models.Lagerbuchungen'
  • 'Myfactory.Models.DimDatum'
  • 'Myfactory.Models.DimPeriode'

from unchase.odata.connectedservice.

goedo avatar goedo commented on June 4, 2024

Hi Nikolaj!
I had a break, now I'm back again with my problem :-)
Basically your generator now works without problems. The issues i've got are:

  • On runtime, I have to substitute the local XML file with the real URL like this:
    static void Main(string[] args)
    {
    MyfactoryService s = new Myfactory.Models.MyfactoryService();
    //MyfactoryService s = new Myfactory.Models.MyfactoryService(new Uri("https://cloud.myfactory-ondemand.ch/saas2/odata_5CYAGwHM"));
    DataServiceQuery selectedLieferanten = s.Lieferanten
    .AddQueryOption("$filter", "PK_LieferantID = 2");
    }
    Right?
  • despite I gave the credentials, I do not see any use of the credentials which I find in ConnectedService.json - is this right?
  • and of course: I've got no clue how to program a very simple get-it-all-query. Are there some examples for this?
    Thank you in advance - and spassibo agromnie!

from unchase.odata.connectedservice.

goedo avatar goedo commented on June 4, 2024

Hi!
Now my program works, but not as expected by design. I had to to some workarounds:

This does not work:

  • MyfactoryService s = new MyfactoryService();
  • var credentials = new NetworkCredential("xxx", "yyy");
  • DataServiceContext ds = new
  • ds.Credentials = credentials;

This works: changing referenceExtensions.cs

  • adding: using System.Net;
  • changing public void InitProperties(), adding
    • this.Credentials = new NetworkCredential("xxx", "yyy");
  • as well as changing the constructor, making it point to the service an not to the local file (which I needed, because some variables had "-" in their name, as well as keys missed the nullable="false" parameter...

Question:

What do you do with the user and pwd asked for at generation, which you write in the json file? It's never used :-(

Last but not least: filtering does not work, not even with Postman. Is this due to the service implementation at myFactory's home?

С уважением!
Roger

from unchase.odata.connectedservice.

goedo avatar goedo commented on June 4, 2024

Looks like the edm-schema specified is not valid for OData validation into

...For my tests I use only Lieferanten. In prod, Kunden and Einkaufsbelege do work as well...

from unchase.odata.connectedservice.

unchase avatar unchase commented on June 4, 2024

Hi, @goedo !

  1. Network credentials wich saved to json file used only for getting the metadata for generating client code.
    If you want to use them, should to add them with standart way in the code.

  2. I can’t answer this question with accuracy, since this is an internal implementation of filtering into libraries, which is used by generated client code.

from unchase.odata.connectedservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.