There's no need to think too hard. You can use the same methods as you normally use with collections.
classProgram{staticasyncTaskMain(string[]args){usingvarcontext=newAppDbContext();varentry=newEntry{Title="buchizo"};// Get exists tagvarexistsTag=awaitcontext.Tags.FirstAsync(x=>x.Name=="kosmosebi");entry.Tags.Add(existsTag);awaitcontext.AddAsync(entry);awaitcontext.SaveChangesAsync();varexistsEntry=awaitcontext.Entries.Include(x=>x.Tags).FirstAsync(x=>x.Id==1);// Remove first tagexistsEntry.Tags.RemoveAt(0);awaitcontext.SaveChangesAsync();}}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
How do you update related entities (in your example how do you create a new entry with existing tags and delete existing tags from an existing entry)
There's no need to think too hard. You can use the same methods as you normally use with collections.