0

I am using MVC3, C# 4.0 and Entity Framework in Visual Studio 2010. I have a complex data entity (one base type which contains two sub-entities; each of these then contain further entities).

I can see how to do a bulk update of everything but wonder what is the best practice for updating this when only a few fields may have changed.

Thanks in advance

2 Answers 2

1

If the properties of multiple sub entities have changed, I would handle it as an update to the complex data entity. If only one of the sub entities needs to be updated, then I would handle it as an update to only that specific entity. It's really a case by case basis type of situation.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - I had thought there would be no simple answer
1

Usually I good idea in such cases is to define a viewmodel which represents the data you get as an input from the user interface. This could be a flat representation of your complex graph. And then in your repository or better in your domain layer there could be a mapping or a handling method/class that fills your modelle or does batch/bulk updates etc...

So usually have some sort of class (or more) in the middle helps usually...

That are my 2 cents without knowing to much of your application architecture...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.