Exemplo n.º 1
0
        /// <summary>
        /// Validate the application settings
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        static string ValidateSettings(ApplicationSettings settings)
        {
            StringBuilder errors = new StringBuilder();

            if (string.IsNullOrWhiteSpace(settings.DatabaseServer))
            {
                errors.AppendLine(settings.GetErrorMsg("DatabaseServer"));
            }
            if (string.IsNullOrWhiteSpace(settings.DatabaseName))
            {
                errors.AppendLine(settings.GetErrorMsg("DatabaseName"));
            }
            if (string.IsNullOrWhiteSpace(settings.DatabaseUsername))
            {
                errors.AppendLine(settings.GetErrorMsg("DatabaseUsername"));
            }
            if (string.IsNullOrWhiteSpace(settings.OutputFolder))
            {
                errors.AppendLine(settings.GetErrorMsg("OutputFolder"));
            }
            if (settings.ObjectType == 0)
            {
                errors.AppendLine(settings.GetErrorMsg("ObjectType"));
            }
            if (string.IsNullOrWhiteSpace(settings.ObjectSchema))
            {
                errors.AppendLine(settings.GetErrorMsg("ObjectSchema"));
            }
            if (string.IsNullOrWhiteSpace(settings.ObjectName))
            {
                errors.AppendLine(settings.GetErrorMsg("ObjectName"));
            }
            if (string.IsNullOrWhiteSpace(settings.AbstractClassNamespace))
            {
                errors.AppendLine(settings.GetErrorMsg("AbstractClassNamespace"));
            }
            if (settings.GenerateConcreteClass == 0)
            {
                errors.AppendLine(settings.GetErrorMsg("GenerateConcreteClass"));
            }
            if (string.IsNullOrWhiteSpace(settings.DalNamespace))
            {
                errors.AppendLine(settings.GetErrorMsg("DalNamespace"));
            }
            if (settings.GenerateDalPublicClass == 0)
            {
                errors.AppendLine(settings.GetErrorMsg("GenerateDalPublicClass"));
            }
            if (string.IsNullOrWhiteSpace(settings.DalConnectionKey))
            {
                errors.AppendLine(settings.GetErrorMsg("DalConnectionKey"));
            }
            if (settings.GenerateInterfaces == 0)
            {
                errors.AppendLine(settings.GetErrorMsg("GenerateInterfaces"));
            }
            if (string.IsNullOrWhiteSpace(settings.InterfaceNamespace))
            {
                errors.AppendLine(settings.GetErrorMsg("InterfaceNamespace"));
            }

            return(errors.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validate the application settings
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        static string ValidateSettings(ApplicationSettings settings)
        {
            StringBuilder errors = new StringBuilder();

            if (string.IsNullOrWhiteSpace(settings.DatabaseServer)) errors.AppendLine(settings.GetErrorMsg("DatabaseServer"));
            if (string.IsNullOrWhiteSpace(settings.DatabaseName)) errors.AppendLine(settings.GetErrorMsg("DatabaseName"));
            if (string.IsNullOrWhiteSpace(settings.DatabaseUsername)) errors.AppendLine(settings.GetErrorMsg("DatabaseUsername"));
            if (string.IsNullOrWhiteSpace(settings.OutputFolder)) errors.AppendLine(settings.GetErrorMsg("OutputFolder"));
            if (settings.ObjectType == 0) errors.AppendLine(settings.GetErrorMsg("ObjectType"));
            if (string.IsNullOrWhiteSpace(settings.ObjectSchema)) errors.AppendLine(settings.GetErrorMsg("ObjectSchema"));
            if (string.IsNullOrWhiteSpace(settings.ObjectName)) errors.AppendLine(settings.GetErrorMsg("ObjectName"));
            if (string.IsNullOrWhiteSpace(settings.AbstractClassNamespace)) errors.AppendLine(settings.GetErrorMsg("AbstractClassNamespace"));
            if (settings.GenerateConcreteClass == 0) errors.AppendLine(settings.GetErrorMsg("GenerateConcreteClass"));
            if (string.IsNullOrWhiteSpace(settings.DalNamespace)) errors.AppendLine(settings.GetErrorMsg("DalNamespace"));
            if (settings.GenerateDalPublicClass == 0) errors.AppendLine(settings.GetErrorMsg("GenerateDalPublicClass"));
            if (string.IsNullOrWhiteSpace(settings.DalConnectionKey)) errors.AppendLine(settings.GetErrorMsg("DalConnectionKey"));
            if (settings.GenerateInterfaces == 0) errors.AppendLine(settings.GetErrorMsg("GenerateInterfaces"));
            if (string.IsNullOrWhiteSpace(settings.InterfaceNamespace)) errors.AppendLine(settings.GetErrorMsg("InterfaceNamespace"));

            return errors.ToString();
        }