Git Product home page Git Product logo

Comments (4)

ra0o0f avatar ra0o0f commented on May 26, 2024

the reason that db.Query().ToList() returns the lastName(with the lower l) member is because json.net deserialize object members if it's camelcased in the json(in your case lastName is camelcase of LastName). but this behavior is not at serializing objects( AQL.Contains(e.LastName, "b") will translate to aql syntax contains(e.LastName,"b") ).

lastName & LastName are two different document members for the ArangoDB database. you could have both of them in an object. did you load Person collection with import tools? if yes try to validate the member names before inserting them(.net client also has a method for import, db.Advanced.BulkImport which is not in nuget package yet)

also there are helper methods in .net client that you can override member name resolving( which does not solve your problem, you should rename lastName & LastName fields to one thing)

                sharedSetting.Collection.ChangeCollectionPropertyForType<Person>(x =>
                {
                    // will resolve all collection members name from PascalCase(c#) to camelcase(ArangoDB)
                    x.Naming = NamingConvention.ToCamelCase;
                });

                sharedSetting.Collection.ChangeDocumentPropertyForType<Person>(x => x.LastName, (p) =>
                {
                    // set the name for just one member
                    p.PropertyName = "lastName";

                    // naming convection for just one member
                    p.Naming = NamingConvention.ToCamelCase;
                });

from arangoclient.net.

adamlubek avatar adamlubek commented on May 26, 2024

thanks for prompt and detailed response. However, I hope that you see why I find this confusing. From my perspective it would be better if this behavior was more consistent i.e. either arango lastName wouldn't be mapped to LastName in C# while using db.Query().ToList() or if field content was included while using db.Query().Where(e => AQL.Contains(e.LastName, "b")).ToList()

from arangoclient.net.

ra0o0f avatar ra0o0f commented on May 26, 2024

you're right, the resolving names should be consistent either in serializing/serializing, i wont close the issue for now.

from arangoclient.net.

ra0o0f avatar ra0o0f commented on May 26, 2024

@adamlubek about consistent member name resolving, json.net behaves First attempts to get an exact case match of propertyName and then a case insensitive match according to http://www.newtonsoft.com/json/help/html/M_Newtonsoft_Json_Serialization_JsonPropertyCollection_GetClosestMatchProperty.htm

from arangoclient.net.

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.