One-to-many relationship getting error in Entity Framework Core when trying to insert data
I'm trying to add data to one-to-many relationship tables. But there is an exception. There are two tables: Post Attachment The Post has many Attachment but one Attachment has one unique post. I'm going to try: Adding records to the Post table, then after that using that post-Id. update the Attachment table Here is the exception thrown InvalidOperationException: The property 'Id' on entity type 'Posts' has a temporary value. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property. at Microsoft.EntityFrameworkCore.Update.Internal