I have a post table and a tag table and bridge table PostTag.
Post 1 has 23 tags , meaning
post p= context.posts.where(p=>p.id=12);
p.tags.Count() =12;
Ok ,fine.
Now I added some new tags to tag table but i want to attach these tags to the same old post
so what i did,
- Post p= context.posts.where(p=.p.id=12);
- foreach(tag t in tags)
- {
- p.tags.add(t);
- }
- context.savechanges();
There is no error, but no output aswell , meaning still post has old tags and new tags are not added to the post.

Varun SetiaPosted Aug 5, 2020, 11:46 AM
Sachin SinghPosted Aug 5, 2020, 11:42 AM
Varun SetiaPosted Aug 5, 2020, 11:41 AM
Sachin SinghPosted Aug 5, 2020, 11:11 AM
Varun SetiaPosted Aug 5, 2020, 10:54 AM
Sachin SinghPosted Aug 5, 2020, 10:22 AM
Varun SetiaPosted Aug 5, 2020, 9:13 AM
Sachin SinghPosted Aug 5, 2020, 9:08 AM
Varun SetiaPosted Aug 5, 2020, 8:59 AM