public static string GetProjectDirectoryArchive(this EnvironmentEnum iValue)
        {
            Type      type      = iValue.GetType();
            FieldInfo fieldInfo = type.GetField(iValue.ToString());

            ProjectDirectoryArchiveAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(ProjectDirectoryArchiveAttribute), false) as ProjectDirectoryArchiveAttribute[];
            ProjectDirectoryArchiveAttribute   value = (ProjectDirectoryArchiveAttribute)attrs.FirstOrDefault();

            return(value != null ? value.ProjectDirectoryArchive : null);
        }
        public static string GetDevelopperTeam(this EnvironmentEnum iValue)
        {
            Type      type      = iValue.GetType();
            FieldInfo fieldInfo = type.GetField(iValue.ToString());

            DevelopperTeamAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(DevelopperTeamAttribute), false) as DevelopperTeamAttribute[];
            DevelopperTeamAttribute   value = (DevelopperTeamAttribute)attrs.FirstOrDefault();

            return(value != null ? value.DevelopperTeam : null);
        }
        public static string GetSpecificationPrefix(this EnvironmentEnum iValue)
        {
            Type      type      = iValue.GetType();
            FieldInfo fieldInfo = type.GetField(iValue.ToString());

            SpecificationPrefixAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(SpecificationPrefixAttribute), false) as SpecificationPrefixAttribute[];
            SpecificationPrefixAttribute   value = (SpecificationPrefixAttribute)attrs.FirstOrDefault();

            return(value != null ? value.SpecificationPrefix : null);
        }
        public static string GetSQLExtendConnectionString(this EnvironmentEnum iValue)
        {
            Type      type      = iValue.GetType();
            FieldInfo fieldInfo = type.GetField(iValue.ToString());

            SQLExtendConnectionStringAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(SQLExtendConnectionStringAttribute), false) as SQLExtendConnectionStringAttribute[];
            SQLExtendConnectionStringAttribute   value = (SQLExtendConnectionStringAttribute)attrs.FirstOrDefault();

            return(value != null ? value.SQLExtendConnectionString : null);
        }
        public static Tuple <string, string> GetLoginPassword(this EnvironmentEnum iValue)
        {
            Type      type      = iValue.GetType();
            FieldInfo fieldInfo = type.GetField(iValue.ToString());

            LoginPasswordAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(LoginPasswordAttribute), false) as LoginPasswordAttribute[];
            LoginPasswordAttribute   value = (LoginPasswordAttribute)attrs.FirstOrDefault();

            return(value != null ? new Tuple <string, string>(value.Login, value.Password) : null);
        }
Ejemplo n.º 6
0
        static HostEnvironment()
        {
            var name = ConfigurationManager.AppSettings["ASPNET_ENVIRONMENT"];

            var enumValue = NameToEnum(name);

            if (enumValue.HasValue)
            {
                environment = enumValue.Value;
            }

            EnvironmentName = environment.ToString();
        }