コード例 #1
0
        private void SetTypeMappingsList(List <TypeMapping> typeMappings)
        {
            // We need to deal with low level serialization to break the dependency between service location and
            // configuration manager, otherwise config mgr and hierarchical config can't be overridden.
            IPropertyBag propertyBag = GetPropertyBag();

            if (propertyBag != null)
            {
                var configData = new ServiceLocationConfigData(typeMappings);
                configData.LastUpdate = DateTime.Now;

                Manager.SetInPropertyBag(GetConfigKey(), configData, propertyBag);
            }
            else
            {
                throw new InvalidOperationException(Resources.ContextMissingSetTypeMappingList);
            }
        }
コード例 #2
0
        private ServiceLocationConfigData GetConfigData()
        {
            // We need to deal with low level seralization to break the dependency between service location and
            // configuration manager, otherwise config mgr and hierarchical config can't be overridden.
            IPropertyBag propertyBag             = GetPropertyBag();
            ServiceLocationConfigData configData = null;

            //In some cases this will be null, like when attempting to load farm service locator config from the
            //sandbox without the proxy installed.
            if (propertyBag != null)
            {
                configData = Manager.GetFromPropertyBag <ServiceLocationConfigData>(GetConfigKey(), propertyBag);
            }

            if (configData == null)
            {
                configData = new ServiceLocationConfigData()
                {
                    LastUpdate = null
                };
            }

            return(configData);
        }