Comments on: Modifying Data with Entity Famework Core https://code-maze.com/efcore-modifying-data/ Learn. Code. Succeed. Wed, 29 Mar 2023 17:38:07 +0000 hourly 1 https://wordpress.org/?v=6.7.5 By: Marinko Spasojević https://code-maze.com/efcore-modifying-data/#comment-7807 Wed, 29 Mar 2023 17:38:07 +0000 https://code-maze.com/?p=48711#comment-7807 In reply to Borjess.

Thank you Borjess. Thanks for the support as well.

]]>
By: Borjess https://code-maze.com/efcore-modifying-data/#comment-7805 Wed, 29 Mar 2023 16:16:36 +0000 https://code-maze.com/?p=48711#comment-7805 It’s always a pleasure to read your articles because I always learn new things about the .Net environment. Many thanks to you and to all the CodeMaze team.

]]>
By: josh linnas https://code-maze.com/efcore-modifying-data/#comment-5729 Fri, 27 May 2022 10:17:24 +0000 https://code-maze.com/?p=48711#comment-5729 In reply to Marinko Spasojević.

Thanks Marinko, I followed your steps and it worked like a charm. Thanks again, you aved me a lot of hustle.

]]>
By: Marinko Spasojević https://code-maze.com/efcore-modifying-data/#comment-5728 Fri, 27 May 2022 09:18:47 +0000 https://code-maze.com/?p=48711#comment-5728 In reply to josh linnas.

Hello Josh. Thanks for the comment, I am glad that the article helped you.

Now, regarding your issue, I am not sure how I can help you like this. I can tell you the steps that you probably already do, but I am not sure how this can help you.

Basically, and this is now just on top of my head, I didn’t test it, you should retrieve that Post you want to update with the PostCategory records related to that post and with Category records for each post from the PostCategory entities. All of this in a single query with Include and ThenInclude. Then you should remove the PostCategory entities, which should mark the Category entities for removal as well. And then you should add new PostCategory records with the connected Category records. And finally, save changes.

Again, I didn’t test this, just added the idea from the top of my head since this is something I would follow in my example.

]]>
By: josh linnas https://code-maze.com/efcore-modifying-data/#comment-5726 Fri, 27 May 2022 05:40:46 +0000 https://code-maze.com/?p=48711#comment-5726 Hello, Thank you for such a great article. Really helped me understand EF core.
I have some problems am experiencing when updating many to many relationship. I have a Post and a Category with a many to many relationship. When updating the categories belonging to the Post, I want to clear the existing categories and add the newly selected ones. But that does not happen, only the post is updated and the old categories remain unchanged. Kindly help.

]]>
By: Marinko Spasojevic https://code-maze.com/efcore-modifying-data/#comment-4530 Sat, 16 Oct 2021 14:29:48 +0000 https://code-maze.com/?p=48711#comment-4530 In reply to nick.

Thank you too, Nick, for reading it and leaving the comment.

]]>
By: nick https://code-maze.com/efcore-modifying-data/#comment-4529 Sat, 16 Oct 2021 13:26:09 +0000 https://code-maze.com/?p=48711#comment-4529 Thanks for this article, well done.

]]>
By: Marinko Spasojevic https://code-maze.com/efcore-modifying-data/#comment-4483 Sat, 09 Oct 2021 10:05:14 +0000 https://code-maze.com/?p=48711#comment-4483 In reply to mohamed tayel.

Thanks a lot. All the best.

]]>
By: mohamed tayel https://code-maze.com/efcore-modifying-data/#comment-4480 Sat, 09 Oct 2021 09:49:23 +0000 https://code-maze.com/?p=48711#comment-4480 very good articles

]]>
By: Marinko https://code-maze.com/efcore-modifying-data/#comment-2478 Sun, 13 Sep 2020 04:08:34 +0000 https://code-maze.com/?p=48711#comment-2478 In reply to Anil Kumar.

Thanks a lot Anil for reading and commenting. I’m glad this article helped you understand the topic.

]]>