public IValueCollectionProvider ValueCollection()
        {
            var vc = new ValueCollectionProvider();
            var entVc = new EntityValueProvider(AppSettings(), "AppSettings");
            vc.Sources.Add("AppSettings".ToLower(), entVc);
            vc.Sources.Add("AppResources".ToLower(), new EntityValueProvider(AppResources(), "AppResources"));

            return vc;
        }
Пример #2
0
        public static IApp App(int appId, PortalSettings ownerPortalSettings)
        {
            var appStuff = new App(ownerPortalSettings, appId);

            var provider = new ValueCollectionProvider(); // use blank provider for now

            appStuff.InitData(false, provider);

            return appStuff;
        }
Пример #3
0
        public ValueCollectionProvider GetConfigurationProvider(int moduleId)
        {
            if (_valueCollectionProvider == null)
            {
                var provider = new ValueCollectionProvider();

                // only add these in running inside an http-context. Otherwise leave them away!
                if (HttpContext.Current != null)
                {
                    var request = HttpContext.Current.Request;
                    provider.Sources.Add("querystring", new FilteredNameValueCollectionPropertyAccess("querystring", request.QueryString));
                    provider.Sources.Add("server", new FilteredNameValueCollectionPropertyAccess("server", request.ServerVariables));
                    provider.Sources.Add("form", new FilteredNameValueCollectionPropertyAccess("form", request.Form));
                }

                // Add the standard DNN property sources if PortalSettings object is available
                if (PS != null)
            {
                    var dnnUsr = PS.UserInfo;
                    var dnnCult = Thread.CurrentThread.CurrentCulture;
                    var dnn = new TokenReplaceDnn(App, moduleId, PS, dnnUsr);
                    var stdSources = dnn.PropertySources;
                    foreach (var propertyAccess in stdSources)
                        provider.Sources.Add(propertyAccess.Key,
                            new ValueProviderWrapperForPropertyAccess(propertyAccess.Key, propertyAccess.Value, dnnUsr, dnnCult));
                }

            provider.Sources.Add("app", new AppPropertyAccess("app", App));

                // add module if it was not already added previously
                if (!provider.Sources.ContainsKey("module"))
                {
                    var modulePropertyAccess = new StaticValueProvider("module");
            modulePropertyAccess.Properties.Add("ModuleID", moduleId.ToString(CultureInfo.InvariantCulture));
            provider.Sources.Add(modulePropertyAccess.Name, modulePropertyAccess);
                }
                _valueCollectionProvider = provider;
            }
            return _valueCollectionProvider;
        }