private PropertyContextSurface ChangeProperty(INakedObject nakedObject, string propertyName, ArgumentContext argument) { ValidateConcurrency(nakedObject, argument.Digest); PropertyContext context = CanChangeProperty(nakedObject, propertyName, argument.Value); if (string.IsNullOrEmpty(context.Reason)) { var spec = context.Target.Spec as IObjectSpec; Trace.Assert(spec != null); IEnumerable<PropertyContext> existingValues = spec.Properties.Where(p => p.Id != context.Id). Select(p => new {p, no = p.GetNakedObject(context.Target)}). Select(ao => new PropertyContext { Property = ao.p, ProposedNakedObject = ao.no, ProposedValue = ao.no == null ? null : ao.no.Object, Target = context.Target } ).Union(new[] {context}); var objectContext = new ObjectContext(context.Target) {VisibleProperties = existingValues.ToArray()}; if (ConsentHandler(CrossValidate(objectContext), objectContext, Cause.Other)) { if (!argument.ValidateOnly) { SetProperty(context); } } else { context.Reason = objectContext.Reason; context.ErrorCause = objectContext.ErrorCause; } } context.Mutated = true; // mark as changed even if property not actually changed to stop self rep return context.ToPropertyContextSurface(this, framework); }