Closed vialeda closed 6 years ago
If I understood your question, this could help you (same question i've asked some time ago): https://github.com/urfnet/URF.Core/issues/24
Yes I concur with @CrazyButch — you can do graph updates with URF support for my Trackable Entities framework.
Let me know if you need further assistance and I’ll re-open.
Would you give me a quick sample please of how setting a trackable property on objects in the graph?
Also, does trackable property take care of Update/Insert/Delete?
If you use the Trackable URF packages and derive your entities from the base Entity
class, each object will have a TrackingState
property which you can set (usually on the client). This enum has values from Unchanged, Added, Modified, Deleted.
Then in your API all you have to do is call ApplyChanges
, followed by SaveChangesAsync
.
Work very well, thank you !! :)
Took me a while to figure this out, so for everyone else:
If you are working with OData (like i do) the TrackingState is not automatically added as a property of your model/entity. You have to do this by hand via the ODataConventionModelBuilder:
entitySetConfigurationShipment.EntityType.EnumProperty(x => x.TrackingState);
Hello, is this possible to save related data without the need of creating a service for each children entities? Let's say you have this post entity:
In order to save it all, I have to create a PostService, PostTranslationService, PostFieldService and a PostFieldTranslationService class. They all have in common an insert method.
Then I have to call them all from PostService:
First => this.Insert(post); Then => postTranslationService.Insert(post.PostTranslations); And then => postFieldService.Insert(post.PostFields, postFieldTranslationService);
I wonder if there is a way to tell EntityFramework with URF.Core to insert them all from this.Insert(post). The version I use from now is 1.0.0-rc1.
Thank you for any advice,
David