public static void EnsureIntegrity(this PropertyExpression propertyExpression, IReflectionService reflectionService) { Argument.IsNotNull(() => propertyExpression); Argument.IsNotNull(() => reflectionService); if (propertyExpression.Property == null) { var serializationValue = propertyExpression.PropertySerializationValue; if (!string.IsNullOrWhiteSpace(serializationValue)) { var splittedString = serializationValue.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries); if (splittedString.Length == 2) { var type = TypeCache.GetType(splittedString[0]); if (type != null) { var typeProperties = reflectionService.GetInstanceProperties(type); propertyExpression.Property = typeProperties.GetProperty(splittedString[1]); } } } } else { // We already have it, but make sure to get the right instance var property = propertyExpression.Property; var typeProperties = reflectionService.GetInstanceProperties(property.OwnerType); propertyExpression.Property = typeProperties.GetProperty(property.Name); } }
public static async Task EnsureIntegrityAsync(this PropertyExpression propertyExpression, IReflectionService reflectionService = null) { Argument.IsNotNull(() => propertyExpression); if (reflectionService == null) { reflectionService = _reflectionService; } if (propertyExpression.Property == null) { using (await LockPropertyExpression.LockAsync()) { var serializationValue = propertyExpression.PropertySerializationValue; if (!string.IsNullOrWhiteSpace(serializationValue)) { var splittedString = serializationValue.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries); if (splittedString.Length == 2) { var type = TypeCache.GetType(splittedString[0]); if (type != null) { var typeProperties = await reflectionService.GetInstancePropertiesAsync(type); propertyExpression.Property = typeProperties.GetProperty(splittedString[1]); } } } } } }
protected override ConditionTreeItem CopyPlainItem() { PropertyExpression copied = new PropertyExpression(); copied.Property = Property; copied.DataTypeExpression = DataTypeExpression; return copied; }
public static void EnsureIntegrity(this PropertyExpression propertyExpression) { Argument.IsNotNull(() => propertyExpression); if (propertyExpression.Property == null) { var serializationValue = propertyExpression.PropertySerializationValue; if (!string.IsNullOrWhiteSpace(serializationValue)) { var splittedString = serializationValue.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries); if (splittedString.Length == 2) { var type = TypeCache.GetType(splittedString[0]); if (type != null) { var typeProperties = _reflectionService.GetInstanceProperties(type); propertyExpression.Property = typeProperties.GetProperty(splittedString[1]); } } } } }
private void OnAddEpression(ConditionGroup group) { PropertyExpression propertyExpression = new PropertyExpression(); propertyExpression.Property = InstanceProperties.Properties.FirstOrDefault(); group.Items.Add(propertyExpression); propertyExpression.Parent = group; }