コード例 #1
0
        public virtual TypedPageData CreateAndPopulateTypedInstance(PageData originalPage, Type typedType)
        {
            TypedPageData typedPage = CreateInstance(typedType);

            TypedPageData.PopuplateInstance(originalPage, typedPage);
            return(typedPage);
        }
コード例 #2
0
 internal void PopuplateInstance(TypedPageData destination, string hierarchy)
 {
     Hierarchy = new PageTypePropertyGroupHierarchy {
         Value = hierarchy
     };
     TypedPageData = destination;
 }
コード例 #3
0
        public virtual TypedPageData CreateAndPopulateTypedInstance(PageData originalPage, Type typedType)
        {
            TypedPageData typedPage = CreateInstance(typedType);

            TypedPageData.PopuplateInstance(originalPage, typedPage);
            PropertyInfo[] properties = typedPage.GetType().GetPublicOrPrivateProperties();
            CreateAndPopulateNestedPropertyGroupInstances(typedPage, typedPage, properties, string.Empty);
            return(typedPage);
        }
コード例 #4
0
        private void CreateAndPopulateNestedPropertyGroupInstances(TypedPageData typedPage, object classInstance,
            IEnumerable<PropertyInfo> properties, string hierarchy)
        {
            foreach (PropertyInfo property in properties.Where(current => current.PropertyType.BaseType == typeof(PageTypePropertyGroup)))
            {
                PageTypePropertyGroup propertyGroup = CreatePropertyGroupInstance(property.PropertyType);
                string propertyName = PageTypePropertyGroupHierarchy.ResolvePropertyName(hierarchy, property.Name);

                propertyGroup.PopuplateInstance(typedPage, propertyName);
                property.SetValue(classInstance, propertyGroup, null);
            }
        }
コード例 #5
0
        internal void CreateAndPopulateNestedPropertyGroupInstances(TypedPageData typedPage, object classInstance,
                                                                    IEnumerable <PropertyInfo> properties, string hierarchy)
        {
            foreach (PropertyInfo property in properties.Where(current => current.PropertyType.BaseType == typeof(PageTypePropertyGroup)))
            {
                PageTypePropertyGroup propertyGroup = CreatePropertyGroupInstance(property.PropertyType);
                string propertyName = PageTypePropertyGroupHierarchy.ResolvePropertyName(hierarchy, property.Name);

                propertyGroup.PopuplateInstance(typedPage, propertyName);
                property.SetValue(classInstance, propertyGroup, null);
            }
        }
コード例 #6
0
        public void Intercept(IInvocation invocation)
        {
            TypedPageData page = (TypedPageData)invocation.InvocationTarget;

            string propertyName = invocation.Method.GetPropertyName();

            if (invocation.Method.IsGetter())
            {
                invocation.ReturnValue = page[propertyName];
                if (invocation.ReturnValue == null && invocation.Method.ReturnType == typeof(bool))
                {
                    invocation.ReturnValue = false;
                }
            }
            else
            {
                page.SetValue(propertyName, invocation.Arguments[0]);
            }
        }
コード例 #7
0
 internal void PopuplateInstance(TypedPageData destination, string hierarchy)
 {
     Hierarchy = new PageTypePropertyGroupHierarchy { Value = hierarchy };
     TypedPageData = destination;
 }