예제 #1
0
        public Server()
        {
            var logger = ObjectFactory.GetInstance<Logger>();
            ObjectFactory.GetInstance<Logger>().Trace("[Server].[Configuration].[Sections].[Server()] invoked.");

            const string isBundlingEnabledKey = "IsBundlingEnabled";
            bool? isBundlingEnabledDefaultValue = null;
            isBundlingEnabled = new AppSettingsSectionProperty<bool?>(isBundlingEnabledKey, isBundlingEnabledDefaultValue);

            const string exceptionLogDepthKey = "ExceptionLogDepth";
            const int exceptionLogDepthDefaultValue = 10;
            exceptionLogDepth = new AppSettingsSectionProperty<int>(exceptionLogDepthKey, exceptionLogDepthDefaultValue);

            Func<int> assemblyUidEvaluator = () => Assembly.GetExecutingAssembly().GetHashCode();
            int assemblyUidDefaultValue = 0;
            assemblyUid = new Evaluator<int>(assemblyUidEvaluator, assemblyUidDefaultValue);

            const string defaultAnonymousVirtualUrlKey = "DefaultAnonymousUrl";
            string defaultAnonymousVirtualUrlDefaultValue = "~/Login";
            defaultAnonymousVirtualUrl = new AppSettingsSectionProperty<string>(defaultAnonymousVirtualUrlKey, defaultAnonymousVirtualUrlDefaultValue);

            const string defaultAuthenticatedVirtualUrlKey = "DefaultAuthenticatedUrl";
            string defaultAuthenticatedVirtualUrlDefaultValue = "~/Login";
            defaultAuthenticatedVirtualUrl = new AppSettingsSectionProperty<string>(defaultAuthenticatedVirtualUrlKey, defaultAuthenticatedVirtualUrlDefaultValue);

            Func<string> defaultAnonymousAbsoluteUrlEvaluator = () => VirtualPathUtility.ToAbsolute(defaultAnonymousVirtualUrl.Value);
            defaultAnonymousAbsoluteUrl = new Evaluator<string>(defaultAnonymousAbsoluteUrlEvaluator, null);

            Func<string> defaultAuthenticatedAbsoluteUrlEvaluator = () => VirtualPathUtility.ToAbsolute(defaultAuthenticatedVirtualUrl.Value);
            defaultAuthenticatedAbsoluteUrl = new Evaluator<string>(defaultAuthenticatedAbsoluteUrlEvaluator, null);

            Func<bool> isBuildReleaseEvaluator = () =>
                #if DEBUG
                    false;
                #else
                    true;
                #endif
            isBuildRelease = new Evaluator<bool>(isBuildReleaseEvaluator);

            Expression<Func<CompilationSection, bool>> isCompilationReleaseEvaluator = s => !s.Debug;
            const bool isCompilationReleaseDefaultValue = false;
            isCompilationRelease = new SystemWebCompilation<bool, bool>(isCompilationReleaseEvaluator, isCompilationReleaseDefaultValue);

            ObjectFactory.GetInstance<Logger>().Trace("[Server].[Configuration].[Sections].[Server()] finished work.");
        }
예제 #2
0
        public Culture()
        {
            var logger = ObjectFactory.GetInstance<Logger>();
            logger.Trace("[Server].[Configuration].[Sections].[Culture()] invoked.");

            const string defaultCultureInfoNameKey = "DefaultCultureInfoName";
            const string defaultCultureInfoNameDefaultValue = "";
            defaultCultureInfoName = new AppSettingsSectionProperty<string>(defaultCultureInfoNameKey, defaultCultureInfoNameDefaultValue);

            Func<CultureInfo> defaultCultureInfoEvaluator = () => CultureInfo.GetCultureInfo(defaultCultureInfoName.Value);
            CultureInfo defaultCultureInfoDefaultValue = CultureInfo.InvariantCulture;
            defaultCultureInfo = new Evaluator<CultureInfo>(defaultCultureInfoEvaluator, defaultCultureInfoDefaultValue);

            const string defaultEncodingNameKey = "DefaultEncodingName";
            const string defaultEncodingNameDefaultValue = "utf-8";
            defaultEncodingName = new AppSettingsSectionProperty<string>(defaultEncodingNameKey, defaultEncodingNameDefaultValue);

            Func<Encoding> defaultEncodingEvaluator = () => Encoding.GetEncoding(defaultEncodingName.Value);
            Encoding defaultEncodingDefaultValue = Encoding.UTF8;
            defaultEncoding = new Evaluator<Encoding>(defaultEncodingEvaluator, defaultEncodingDefaultValue);

            const string defaultGuidFormatKey = "DefaultGuidFormat";
            const string defaultGuidFormatDefaultValue = "N";
            defaultGuidFormat = new AppSettingsSectionProperty<string>(defaultGuidFormatKey, defaultGuidFormatDefaultValue);

            const string defaultDateTimeFormatKey = "DefaultDateTimeFormat";
            const string defaultDateTimeFormatDefaultValue = "dd/MM/yyyy HH:mm:ss";
            defaultDateTimeFormat = new AppSettingsSectionProperty<string>(defaultDateTimeFormatKey, defaultDateTimeFormatDefaultValue);

            const string defaultDateFormatKey = "DefaultDateFormat";
            const string defaultDateFormatDefaultValue = "dd/MM/yyyy";
            defaultDateFormat = new AppSettingsSectionProperty<string>(defaultDateFormatKey, defaultDateFormatDefaultValue);

            const string defaultTimeFormatKey = "DefaultTimeFormat";
            const string defaultTimeFormatDefaultValue = "HH:mm:ss";
            defaultTimeFormat = new AppSettingsSectionProperty<string>(defaultTimeFormatKey, defaultTimeFormatDefaultValue);

            const string defaultTimespanFormatKey = "DefaultTimespanFormat";
            const string defaultTimespanFormatDefaultValue = "HH:mm:ss";
            defaultTimespanFormat = new AppSettingsSectionProperty<string>(defaultTimespanFormatKey, defaultTimespanFormatDefaultValue);

            logger.Trace("[Server].[Configuration].[Sections].[Culture()] finished work.");
        }