Change the "ID" field to "Id"
See original GitHub issueThis way, when libraries that automatically camelcase the name of the fields (json serialization, graphql model serialization), it will get named “id” rather than “iD”. This is the conventional way of casing Id fields.
Since we are required to inherit from Entity or implement IEntity, this should really follow Microsoft conventions on casing.
This is what I have to do in all of my models just to get behavior that would work automatically if the field were named “Id”.
[Name("results")]
public class OrderResults: Results, IEntity, IModifiedOn {
[GraphQLName("id"), GraphQLType(typeof(NonNullType<IdType>))]
[BsonId, BsonRepresentation(BsonType.ObjectId)]
public string ID { get; set; } = ObjectId.GenerateNewId().ToString();
public DateTime ModifiedOn { get; set; } = DateTime.Now;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
change id field to people_id
Hi I am trying to change the id field to people_id and simply display from a route as I am learning trying to...
Read more >ASP.Net core change field from default id to custom id
I did some research on Ef core and the primary key etc, and it seems that Ef core will use the Id field...
Read more >How to Edit ID Field?
The ID field (I'm assuming you mean primary key field) should NOT be changing if you delete a record, especially if there are...
Read more >How to Rename ID Column in SharePoint List?
Go to the List settings page · Pick any column such as “Title”. You'll get the Edit Column page. · Change the Field...
Read more >Is it possible to update default ID column of a list in ...
It's not possible to update the default ID column of a list in SharePoint online. ID field is an auto-increase column and it's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
another alternative is for you to fork the source and make your own version of the library with an
Id
property onIEntity
Thank you for the quick response.