Entity Framework - How to update fields from a list of key-value pairs?
问题 Let's say the user modifies his profile record that contains fields such as FirstName, LastName, Email, etc. For each field that is modified, the change is stored as a key-value pair in a list of type: List<Tuple<string, object>> The key in this key-value pair represents the actual table column. While trying to update the record, here is one way to do it: foreach (Tuple<string, object> field in changeList) { if (field.Item1.equals("FirstName")) { user.FirstName = field.Item2; } if (field