Пример #1
0
        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]);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        protected override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            InstanceProperties = (await _reflectionService.GetInstancePropertiesAsync(_originalFilterScheme.TargetType)).Properties;

            UpdatePreviewItems();

            FilterScheme.Updated += OnFilterSchemeUpdated;
        }
        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]);
                            }
                        }
                    }
                }
            }
        }