.net - Self Tracking Entities (STE)'s and partial updates with EF4 and mVC2 -


I have an MVC2 app where I'm starting to use 'I'm looking for some explanation How updates should work.

Background:

If I have a blog entity with related category entities and related posts / comments, In MVC I am providing a view with main blog unit and categories but not related posts. When I post back the blog unit to the server, then I can see the related categories but not the post (because they were not in the view) back in the unit ordered on the server. In addition, there is a changing state of the blog unit's 'edited'.

Then I'll try to call the implementer () and SaveChanges () to make an update to the unit and post it With FK fails due to relationships and the fact is that there are related posts in the database but I am returning back.

With some more trials ... if I take a current example of the blog unit (with all related FK entities), while connected to the server (state = unchanged), modify the property (State = modified) and it works as expected in the update

So my question: If I have institutions which are not being provided in one view And so do not post back with blog unit Should In update should work?

Why does the blog entity get back with 'added' status and not 'modified'? I would think that it will come back with 'Modified' change for all changed entities and then when I have called Apply Changel / Save Change () , then we will try to update only the revised items and this reason That would not be me all related entities.

Can I pass an entity directly from a client and ApplyChanges () / SaveChengs () or I should post the unit back on the server, grab the existing copy from the database Applying the change in that copy, and then posting the existing object back?

As the first problem:

Then I have an update I try to call ApplyChanges () and SaveChanges () on this blog unit and it fails to relate to the terms of FK and the fact that there are related posts in the database, but I am sending back the unit Is not attached.

This may be due to your other issu ("added" instead of "modified" state)

Why blog Changes to Does the unit get a post back with a 'added' position and not 'modified'? I thought that it would come back with 'Modified' change for all the changing entities, and then when I applied Upper Change / Save Changes, I will try to update only the revised items, and so I do not need all related entities. Will be.

To consider the issue "Are you using similar type of public code on server and client"? STE has been done when you use the data-service metadata type generated. For STE, there is an important part of the code that is activated in the manufacturer, which does not continue through metadata generated types and hence the cause of this problem.

And for your last Xcity:

Can I pass directly to the client and applyChanges () / Save Changes () to an organization or return me to the server Must post, grab the existing copy from the database, apply the change to that copy, and then post the existing object again?

Yes, it is possible (I have tested it) to ApplyChanges () / Save Changes directly to the entities coming from the client, wherever the unit originally came from ( Modified from the server or created as a new unit to the customer).


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

jQuery UI: Datepicker month format -

php - multilevel menu with multilevel array -