Exemplo n.º 1
0
        public static bool IsInterceptable(this ItemDefinition definition, string propertyName)
        {
            PropertyDefinition property;
            IEnumerable <IInterceptableProperty> attributes;

            if (definition.Properties.TryGetValue(propertyName, out property))
            {
                return(definition.IsInterceptable(property.Info, out attributes));
            }
            return(false);
        }
Exemplo n.º 2
0
        private IEnumerable <AttributedProperty> GetInterceptableProperties(ItemDefinition definition)
        {
            // Also include properties on base classes since properties are matched by reference and
            // and we want to intercept calls to properties on base classes with the same name
            for (Type t = definition.ItemType; t != null; t = t.BaseType)
            {
                foreach (var property in t.GetProperties())
                {
                    IEnumerable <IInterceptableProperty> attributes;
                    if (!definition.IsInterceptable(property, out attributes))
                    {
                        continue;
                    }

                    yield return(new AttributedProperty {
                        Property = property, Attribute = attributes.First()
                    });
                }
            }
        }
Exemplo n.º 3
0
        private IEnumerable<AttributedProperty> GetInterceptableProperties(ItemDefinition definition)
        {
            // Also include properties on base classes since properties are matched by reference and
            // and we want to intercept calls to properties on base classes with the same name
            for (Type t = definition.ItemType; t != null; t = t.BaseType)
            {
                foreach (var property in t.GetProperties())
                {
                    IEnumerable<IInterceptableProperty> attributes;
                    if (!definition.IsInterceptable(property, out attributes))
                        continue;

                    yield return new AttributedProperty { Property = property, Attribute = attributes.First() };
                }
            }
        }