コード例 #1
0
        public virtual ActionResult Index()
        {
            var settings = (from p in typeof(IAppConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                        where p.CanRead
                        select p)
                       .ToDictionary(p => p.Name, p =>
                       {
                           var propertyType = p.PropertyType;
                           var propertyValue = p.GetValue(_config.Current);

                           if (propertyValue != null && p.Name.ToLowerInvariant().Contains("connectionstring"))
                           {
                               propertyValue = new string('*', 10);
                           }

                           return Tuple.Create(propertyType, propertyValue);
                       });

            var features = (from p in typeof(FeatureConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                            where p.CanRead
                            select new FeatureConfigViewModel(p, _config.Features))
                            .ToList();


            var configModel = new ConfigViewModel(settings, features, _auth.Authenticators.Values);

            return View(configModel);
        }
コード例 #2
0
        public virtual ActionResult Index()
        {
            var dict = (from p in typeof(IAppConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                        where p.CanRead
                        select p)
                       .ToDictionary(p => p.Name, p => Tuple.Create(p.PropertyType, p.GetValue(_config)));

            var configModel = new ConfigViewModel(dict);

            return View(configModel);
        }
コード例 #3
0
        public virtual ActionResult Index()
        {
            var settings = (from p in typeof(IAppConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                        where p.CanRead
                        select p)
                       .ToDictionary(p => p.Name, p => Tuple.Create(p.PropertyType, p.GetValue(_config.Current)));
            var features = (from p in typeof(FeatureConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                            where p.CanRead
                            select new FeatureConfigViewModel(p, _config.Features))
                            .ToList();


            var configModel = new ConfigViewModel(settings, features, _auth.Authenticators.Values);

            return View(configModel);
        }