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
Tarique Sultan
1.5k
219
14.1k
How to Update and Delete related entities of an Object by EF
Mar 20 2018 10:06 PM
Let's suppose we have table called "EmployeeMaster" in our database and four sub-table like "Qualification", "TechnicalSkills", "BankDetails" and "EmploymentHistory".
They have foreign key relationship with "EmployeeMaster" table.
So i want to know, how to update and delete related Entities! means in "EmployeeMaster" table we have "List Collection" which are listed below.
List
technicalList{
get
;
set
;}
List
qualificationList {
get
;
set
;}
List
bankDetailsList {
get
;
set
;}
List
employmentHistoryList {
get
;
set
;}
when i pass "EmployeeMaster table object to update and delete methods in EF" then related entities of type listed above also be updated and deleted if i marked their object "Added" "Modifed" and "Deleted" in "EmployeeMaster" table related entities and this system of updating, adding or modifying related entites must be in generic form.
Right now! to make this done, we are using one repository per class and we are using database first approach and with two entities database entities and our custom model entities same as database entities and we are using Automapper.dll to map them together.
Kindly help to get this done using generic repository pattern system but keep in mind,
I want my Update Delete and Add method to Update, Delete and Add related entities.
Reply
Answers (
1
)
how to respository class in asp net c#
Exception handling