public static AggregatedBaseConfiguration ConfigurationFromData(OwaConfigurationBaseData data)
        {
            AllowOfflineOnEnum allowOfflineOn;

            Enum.TryParse <AllowOfflineOnEnum>(data.AllowOfflineOn, out allowOfflineOn);
            InstantMessagingTypeOptions instantMessagingType;

            Enum.TryParse <InstantMessagingTypeOptions>(data.InstantMessagingType, out instantMessagingType);
            OutboundCharsetOptions outboundCharset;

            Enum.TryParse <OutboundCharsetOptions>(data.OutboundCharset, out outboundCharset);
            return(new AggregatedBaseConfiguration
            {
                AllowCopyContactsToDeviceAddressBook = data.AllowCopyContactsToDeviceAddressBook,
                AllowOfflineOn = allowOfflineOn,
                AttachmentPolicy = AggregatedBaseConfiguration.AttachmentPolicyFromData(data.AttachmentPolicy),
                DefaultTheme = data.DefaultTheme,
                InstantMessagingEnabled = data.InstantMessagingEnabled,
                InstantMessagingType = instantMessagingType,
                OutboundCharset = outboundCharset,
                PlacesEnabled = data.PlacesEnabled,
                WeatherEnabled = data.WeatherEnabled,
                RecoverDeletedItemsEnabled = data.RecoverDeletedItemsEnabled,
                SegmentationFlags = data.SegmentationFlags,
                UseGB18030 = data.UseGB18030,
                UseISO885915 = data.UseISO885915
            });
        }
        private ConfigurationBase GetConfiguration()
        {
            ConfigurationBase result = this.configurationBase;

            if (result == null)
            {
                if (this.aggregationContext == null)
                {
                    result = this.GetPolicyOrVdirConfiguration(null, null, null, null, null, new bool?(false));
                }
                else
                {
                    NameValueCollection requestHeaders = null;
                    string requestUserAgent            = null;
                    string rawUrl          = null;
                    Uri    uri             = null;
                    string userHostAddress = null;
                    bool?  isLocal         = null;
                    if (HttpContext.Current != null && HttpContext.Current.Request != null)
                    {
                        requestHeaders   = HttpContext.Current.Request.Headers;
                        requestUserAgent = HttpContext.Current.Request.UserAgent;
                        rawUrl           = HttpContext.Current.Request.RawUrl;
                        uri             = HttpContext.Current.Request.Url;
                        userHostAddress = HttpContext.Current.Request.UserHostAddress;
                        isLocal         = new bool?(HttpContext.Current.Request.IsLocal);
                    }
                    OwaConfigurationBaseData data = this.aggregationContext.ReadType <OwaConfigurationBaseData>("OWA.ConfigurationBase", delegate
                    {
                        result = this.GetPolicyOrVdirConfiguration(requestHeaders, requestUserAgent, rawUrl, uri, userHostAddress, isLocal);
                        return(AggregatedBaseConfiguration.DataFromConfiguration(result));
                    });
                    if (result == null)
                    {
                        result = AggregatedBaseConfiguration.ConfigurationFromData(data);
                    }
                }
            }
            this.configurationBase = result;
            return(result);
        }