Example #1
0
        public static IPropertyBagHierarchy GetHierarchy(SPWeb web)
        {
            IPropertyBagHierarchy hierarchyStack = null;

            if (SharePointEnvironment.InSandbox)
            {
                if (web == null && SharePointEnvironment.CanAccessFarmConfig)
                {
                    return new SandboxFarmPropertyBagHierarchy();
                }

                Validation.ArgumentNotNull(web, "web");

                if (SharePointEnvironment.CanAccessFarmConfig)
                {
                    hierarchyStack = new SandboxWithProxyPropertyBagHierarchy(web);
                }
                else
                {
                    hierarchyStack = new SandboxPropertyBagHierarchy(web);
                }
            }
            else
            {
                if (web != null)
                {
                    hierarchyStack = new FullTrustPropertyBagHierarchy(web);
                }
                else
                {
                    hierarchyStack = GetFarmHierarchy();
                }
            }
            return hierarchyStack;
        }
        public static IPropertyBagHierarchy GetHierarchy(SPWeb web)
        {
            IPropertyBagHierarchy hierarchyStack = null;

            if (SharePointEnvironment.InSandbox)
            {
                if (web == null && SharePointEnvironment.CanAccessFarmConfig)
                {
                    return(new SandboxFarmPropertyBagHierarchy());
                }

                Validation.ArgumentNotNull(web, "web");

                if (SharePointEnvironment.CanAccessFarmConfig)
                {
                    hierarchyStack = new SandboxWithProxyPropertyBagHierarchy(web);
                }
                else
                {
                    hierarchyStack = new SandboxPropertyBagHierarchy(web);
                }
            }
            else
            {
                if (web != null)
                {
                    hierarchyStack = new FullTrustPropertyBagHierarchy(web);
                }
                else
                {
                    hierarchyStack = GetFarmHierarchy();
                }
            }
            return(hierarchyStack);
        }