TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sachin Singh
7
55.8k
81.8k
EF add data to the same navigation property many to many .
Aug 5 2020 8:35 AM
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.
Reply
Answers (
9
)
Purpose of Classic and Integrated mode in IIS
Looping in SQL with Where condition