Hi guys,
Please I need help on how to handle CRUD in ef4 way. I started a project on asp.net mvc1 and ef v1 .net 3.5 sp1, but along the line after the release of vs 2010 I converted the application to asp.net mvc2 and ef4 .net4 after some reading on the new features both technologies offers.
Right now am kinda stock as things don't appear as easy as I thought, and the deadline for the project is fast approaching. I'll appreciate some help mainly on how to create, update and delete without doing database trip where it's not needed.
I found a way to handle the CRUD commands without the database trip, but the issue with this approach is that it overwrites all unchanged and database generated values (getutcdate(). etc)in the database and it does not work for the object graph (the object relationship). Please any quick advice on how to do things right? The code for my update command is this.
dc.PersonEntitySet.Attach(entity);ObjectStateEntry entry = dc.ObjectStateManager.GetObjectStateEntry(entity);entry.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
Am currently using POCO on the client and manually convert it on the DAL to entity framework entity before doing the ef operation.
Thanks.