private void ValidateReadOnlyProperties(ModelStateDictionary?modelState) { // assumes presence means value is true! foreach (var property in _members.Where(x => x.HasAttribute <ReadOnlyAttribute>())) { if (_changed.Contains(property.Name)) { modelState?.AddModelError(property.Name, $"ApplyTo is attempting to change '{property.Name}' to '{_reads[_data, property.Name]}', but it is defined as read only."); } } }
/// <summary> /// Returns only fields fit to store along with the resource (value types, and not resources or non-value collections). /// </summary> /// <param name="members"></param> /// <returns></returns> public static AccessorMember[] GetValueTypeFields(this AccessorMembers members) { return(members.Where(x => !IsChildResource(x) && IsValueType(x)).ToArray()); }