Beispiel #1
0
        internal static List <PostPair> GetPostPair(object entity, Control parentControl)
        {
            Type            entityType = entity.GetType();
            string          key        = parentControl.Page.Request.Path + entityType.Name;
            List <PostPair> list       = (List <PostPair>)HttpRuntime.Cache[key];

            if (list == null)
            {
                lock (GetLocker(parentControl.Page.Request.Path))
                {
                    list = (List <PostPair>)HttpRuntime.Cache[key];
                    if (list == null)
                    {
                        HttpRuntime.Cache[key] = list = new List <PostPair>();
                        foreach (PropertyAccess property in EntityUtility.GetEnumerable(entityType))
                        {
                            Control control = FindControl(parentControl, string.Concat(ControlPrefix, property.MappedName))
                                              ?? FindControl(parentControl, string.Concat("auto", property.MappedName));
                            if (control != null)
                            {
                                list.Add(new PostPair(control.UniqueID, property));
                            }
                        }
                    }
                }
            }
            return(list);
        }