Update / Add Navigation Properties with Entity framework -
i using repository , unit of work pattern entity framework 6.
my entities (model classes) have following relationship:
article ______________ __________|__________ _______________ | | | | tags images references authors reviewers
whenever article
created, data inserted tables (i.e. article
, tags
, images
, references
, authors
, reviewers
. there one-to-many relationship between article
, other child tables. add
method passed article
object following:
public class article { public int articleid {get;set;} icollection tags {get;set;} icollection images {get;set;} icollection authors {get;set;} icollection reviewers {get;set;} }
adding database simple , doing following:
public void add (article arc) { this.context.article.add(arc); }
for update, not getting best way of doing this. user can pass on object of article amended navigation properties and/or added more. e.g. existing reviewer can amended added more.
i have composite key in each of navigation properties (e.g. tags
tagid
, articleid
).
please suggest approach
Comments
Post a Comment