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

Problem with id #45

Open
tsteele opened this issue Feb 4, 2019 · 6 comments
Open

Problem with id #45

tsteele opened this issue Feb 4, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@tsteele
Copy link

tsteele commented Feb 4, 2019

In the latest version 0.3.4.3-rc1 I have converted to using IVertex, so my vertex now includes Id:

public class Site : IVertex { public string Id { get; set; } public string SiteName { get; set; } }

However, when I create a site with a specified id, the id gets assigned a GUID and Id appears as a separate property in the database.

How do set the DB id to a specified value?

@evo-terren
Copy link
Owner

I could very well be wrong, but I believe this is a limitation with how graphs work (at least in CosmosDB). I am having difficulty finding documentation to support this, however.

My team have set our ids to custom properties instead of using the built-in "id" field.

@evo-terren evo-terren added the bug Something isn't working label Feb 4, 2019
@evo-terren
Copy link
Owner

Just to be clear, did this used to work before the latest version?

@tsteele
Copy link
Author

tsteele commented Feb 4, 2019

Yes it did work , The id field was included in VertexBase which you inherited.

I have managed to get it to work using:
[JsonProperty("id")] public string Id { get; set; }

@tsteele
Copy link
Author

tsteele commented Feb 4, 2019

This obviously forces it to serialise the Id field as id.

@BenjaBobs
Copy link
Collaborator

Do note though, that the native id property is not indexed the same way as custom properties, and if you're working with partitioned data, there might be significant performance to be gained by also storing the id in a custom property (my team uses the name idx.)

@tsteele
Copy link
Author

tsteele commented Feb 5, 2019

Thanks for the replies, I think I'll go back to using the old version 0.3.4.2-rc1 due to the problems with this latest version, see #46 . still think its a great lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants