private static ChildPropertyInfo ExtractProperty(IModelDataAccessor dataAccessor, Expression propertyPicker) { if (propertyPicker == null) { throw new ArgumentNullException(nameof(propertyPicker)); } var property = PropertyVisitor.ExtractProperty(propertyPicker); var result = dataAccessor.ChildProperties.FirstOrDefault(p => p.Property == property); return(result ?? throw new GitObjectDbException($"Member should be a child property.")); }
private void ValidateChildren(ValidationContext context, IModelDataAccessor dataProvider, List <ValidationFailure> result) { foreach (var childProperty in dataProvider.ChildProperties) { var children = childProperty.Accessor(context.Instance); if (children != null) { foreach (var child in children) { var nestedContext = context.NewNested(childProperty, child); ValidateImpl(nestedContext, result); } } } ValidateContainer(context, result); }
private void ValidatePropertyValues(ValidationContext context, IModelDataAccessor dataProvider, List <ValidationFailure> result) { foreach (var property in dataProvider.ModifiableProperties) { var propertyValue = property.Accessor(context.Instance); if (propertyValue == null) { continue; } if (property.IsDiscriminatedUnion) { ValidateDiscriminatedUnion(context, property.Name, propertyValue, result); } else { ValidatePropertyValue(context, property.Name, propertyValue, result); } } }
private static void UpdateNodeIfNeeded(IModelObject original, IModelObject @new, Stack <string> stack, IModelDataAccessor accessor, IList <ObjectRepositoryEntryChanges> changes) { if (accessor.ModifiableProperties.Any(p => !p.AreSame(original, @new))) { var path = stack.ToDataPath(); changes.Add(new ObjectRepositoryEntryChanges(path, ChangeKind.Modified, original, @new)); } }