예제 #1
0
        public string GetLocalizedStringValue(string keyName)
        {
            LocalizedDefaultValueAttribute localized = new LocalizedDefaultValueAttribute(keyName);

            return((string)localized.Value);
        }
예제 #2
0
        public static SMOScriptOptions CreateFromConfig()
        {
            var smoScriptOpts = new SMOScriptOptions();
            LocalizedDefaultValueAttribute target = new LocalizedDefaultValueAttribute(CommonFunc.GetAppSettingsStringValue("TargetServerType"));

            if (target != null && target.Value.ToString().Length > 0)
            {
                smoScriptOpts.TargetServer = (string)target.Value;
            }

            smoScriptOpts.ScriptDefaults     = CommonFunc.GetAppSettingsBoolValue("ScriptDefaults");
            smoScriptOpts.ScriptHeaders      = CommonFunc.GetAppSettingsBoolValue("ScriptHeaders");
            smoScriptOpts.IncludeIfNotExists = CommonFunc.GetAppSettingsBoolValue("IncludeIfNotExists");

            LocalizedDefaultValueAttribute sdc = new LocalizedDefaultValueAttribute(ConfigurationManager.AppSettings["ScriptDropCreate"]);

            smoScriptOpts.ScriptDropCreate = (string)sdc.Value;

            smoScriptOpts.ScriptCheckConstraints = CommonFunc.GetAppSettingsBoolValue("ScriptCheckConstraints");
            smoScriptOpts.ScriptCollation        = CommonFunc.GetAppSettingsBoolValue("ScriptCollation");
            smoScriptOpts.ScriptForeignKeys      = CommonFunc.GetAppSettingsBoolValue("ScriptForeignKeys");
            smoScriptOpts.ScriptPrimaryKeys      = CommonFunc.GetAppSettingsBoolValue("ScriptPrimaryKeys");
            smoScriptOpts.ScriptUniqueKeys       = CommonFunc.GetAppSettingsBoolValue("ScriptUniqueKeys");
            smoScriptOpts.ScriptIndexes          = CommonFunc.GetAppSettingsBoolValue("ScriptIndexes");

            LocalizedDefaultValueAttribute stad = new LocalizedDefaultValueAttribute(ConfigurationManager.AppSettings["ScriptTableAndOrData"]);

            smoScriptOpts.ScriptTableAndOrData = (string)stad.Value;

            if (smoScriptOpts.ScriptTableAndOrData.Length == 0)
            {
                if (CommonFunc.GetAppSettingsBoolValue("ScriptData"))
                {
                    smoScriptOpts.ScriptTableAndOrData = Properties.Resources.ScriptOptionsTableSchemaData;
                }
                else
                {
                    smoScriptOpts.ScriptTableAndOrData = Properties.Resources.ScriptOptionsTableSchema;
                }
            }

            smoScriptOpts.ScriptTableTriggers = CommonFunc.GetAppSettingsBoolValue("ScriptTableTriggers");

            smoScriptOpts.ActiveDirectorySP      = CommonFunc.GetAppSettingsBoolValue("ActiveDirectorySP");
            smoScriptOpts.BackupandRestoreTable  = CommonFunc.GetAppSettingsBoolValue("BackupandRestoreTable");
            smoScriptOpts.ChangeDataCapture      = CommonFunc.GetAppSettingsBoolValue("ChangeDataCapture");
            smoScriptOpts.ChangeDataCaptureTable = CommonFunc.GetAppSettingsBoolValue("ChangeDataCaptureTable");

            LocalizedDefaultValueAttribute cc = new LocalizedDefaultValueAttribute(ConfigurationManager.AppSettings["CompatibilityChecks"]);

            smoScriptOpts.CompatibilityChecks = (string)cc.Value;

            smoScriptOpts.DatabaseEngineSP         = CommonFunc.GetAppSettingsBoolValue("DatabaseEngineSP");
            smoScriptOpts.DatabaseMailSP           = CommonFunc.GetAppSettingsBoolValue("DatabaseMailSP");
            smoScriptOpts.DatabaseMaintenancePlan  = CommonFunc.GetAppSettingsBoolValue("DatabaseMaintenancePlan");
            smoScriptOpts.DataControl              = CommonFunc.GetAppSettingsBoolValue("DataControl");
            smoScriptOpts.DistributedQueriesSP     = CommonFunc.GetAppSettingsBoolValue("DistributedQueriesSP");
            smoScriptOpts.FullTextSearchSP         = CommonFunc.GetAppSettingsBoolValue("FullTextSearchSP");
            smoScriptOpts.GeneralExtendedSPs       = CommonFunc.GetAppSettingsBoolValue("GeneralExtendedSPs");
            smoScriptOpts.GeneralTSQL              = CommonFunc.GetAppSettingsBoolValue("GeneralTSQL");
            smoScriptOpts.IntegrationServicesTable = CommonFunc.GetAppSettingsBoolValue("IntegrationServicesTable");
            smoScriptOpts.LogShipping              = CommonFunc.GetAppSettingsBoolValue("LogShipping");
            smoScriptOpts.MetadataFunction         = CommonFunc.GetAppSettingsBoolValue("MetadataFunction");
            smoScriptOpts.OLEAutomationSP          = CommonFunc.GetAppSettingsBoolValue("OLEAutomationSP");
            smoScriptOpts.OLEDBTable                = CommonFunc.GetAppSettingsBoolValue("OLEDBTable");
            smoScriptOpts.ProfilerSP                = CommonFunc.GetAppSettingsBoolValue("ProfilerSP");
            smoScriptOpts.ReplicationSP             = CommonFunc.GetAppSettingsBoolValue("ReplicationSP");
            smoScriptOpts.ReplicationTable          = CommonFunc.GetAppSettingsBoolValue("ReplicationTable");
            smoScriptOpts.RowsetFunction            = CommonFunc.GetAppSettingsBoolValue("RowsetFunction");
            smoScriptOpts.SecurityFunction          = CommonFunc.GetAppSettingsBoolValue("SecurityFunction");
            smoScriptOpts.SecuritySP                = CommonFunc.GetAppSettingsBoolValue("SecuritySP");
            smoScriptOpts.SQLMailSP                 = CommonFunc.GetAppSettingsBoolValue("SQLMailSP");
            smoScriptOpts.SQLServerAgentSP          = CommonFunc.GetAppSettingsBoolValue("SQLServerAgentSP");
            smoScriptOpts.SQLServerAgentTable       = CommonFunc.GetAppSettingsBoolValue("SQLServerAgentTable");
            smoScriptOpts.SystemCatalogView         = CommonFunc.GetAppSettingsBoolValue("SystemCatalogView");
            smoScriptOpts.SystemFunction            = CommonFunc.GetAppSettingsBoolValue("SystemFunction");
            smoScriptOpts.SystemStatisticalFunction = CommonFunc.GetAppSettingsBoolValue("SystemStatisticalFunction");
            smoScriptOpts.Unclassified              = CommonFunc.GetAppSettingsBoolValue("Unclassified");

            return(smoScriptOpts);
        }
예제 #3
0
        public string GetAppConfigCompabilitySetting()
        {
            LocalizedDefaultValueAttribute cc = new LocalizedDefaultValueAttribute(ConfigurationManager.AppSettings["CompatibilityChecks"]);

            return((string)cc.Value);
        }