in src/Microsoft.SqlTools.ServiceLayer/Admin/Database/DatabasePrototype.cs [117:272]
public DatabaseData(CDataContainer context)
{
this.name = string.Empty;
this.owner = string.Empty;
this.restrictAccess = DatabaseUserAccess.Multiple;
this.isReadOnly = false;
this.databaseState = DatabaseStatus.Normal;
this.closeCursorOnCommit = false;
this.defaultCursor = DefaultCursor.Global;
this.autoClose = false;
this.autoShrink = false;
this.autoCreateStatistics = true;
this.autoCreateStatisticsIncremental = false;
this.autoUpdateStatistics = true;
this.autoUpdateStatisticsAsync = false;
this.ansiNullDefault = false;
this.ansiNulls = false;
this.ansiPadding = false;
this.ansiWarnings = false;
this.arithabort = false;
this.concatNullYieldsNull = false;
this.numericRoundAbort = false;
this.quotedIdentifier = false;
this.recursiveTriggers = false;
this.recoveryModel = RecoveryModel.Simple;
this.dbChaining = false;
this.trustworthy = false;
this.dateCorrelationOptimization = false;
this.brokerEnabled = false;
this.parameterization = false;
this.varDecimalEnabled = false;
this.encryptionEnabled = false;
this.honorBrokerPriority = false;
this.filestreamNonTransactedAccess = FilestreamNonTransactedAccessType.Off;
this.filestreamDirectoryName = String.Empty;
this.delayedDurability = DelayedDurability.Disabled;
this.azureEdition = AzureEdition.Standard;
this.azureEditionDisplayValue = AzureEdition.Standard.ToString();
this.configuredServiceLevelObjective = String.Empty;
this.currentServiceLevelObjective = String.Empty;
this.maxSize = new DbSize(0, DbSize.SizeUnits.MB);
this.maxDop = 0;
this.maxDopForSecondary = null;
this.legacyCardinalityEstimation = DatabaseScopedConfigurationOnOff.Off;
this.legacyCardinalityEstimationForSecondary = DatabaseScopedConfigurationOnOff.Primary;
this.parameterSniffing = DatabaseScopedConfigurationOnOff.On;
this.parameterSniffingForSecondary = DatabaseScopedConfigurationOnOff.Primary;
this.queryOptimizerHotfixes = DatabaseScopedConfigurationOnOff.Off;
this.queryOptimizerHotfixesForSecondary = DatabaseScopedConfigurationOnOff.Primary;
//The following properties are introduced for contained databases.
//In case of plain old databases, these values should reflect the server configuration values.
this.defaultFulltextLanguageLcid = context.Server.Configuration.DefaultFullTextLanguage.ConfigValue;
int defaultLanguagelangid = context.Server.Configuration.DefaultLanguage.ConfigValue;
this.defaultLanguageLcid = 1033; // LanguageUtils.GetLcidFromLangId(context.Server, defaultLanguagelangid);
this.nestedTriggersEnabled = context.Server.Configuration.NestedTriggers.ConfigValue == 1;
this.transformNoiseWords = context.Server.Configuration.TransformNoiseWords.ConfigValue == 1;
this.twoDigitYearCutoff = context.Server.Configuration.TwoDigitYearCutoff.ConfigValue;
this.targetRecoveryTime = 0;
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
//in katmai var decimal going to be true by default
if (context.Server.Information.Version.Major >= 10)
{
this.varDecimalEnabled = true;
}
if (7 < context.Server.Information.Version.Major)
{
this.collation = this.defaultCollation = manager.GetString("general_default");
}
else
{
this.collation = String.Empty;
}
if (9 <= context.Server.Information.Version.Major)
{
this.pageVerify = PageVerify.Checksum;
}
else
{
this.pageVerify = PageVerify.TornPageDetection;
}
// Full-text indexing will always be enabled in Katmai
if (context.Server.Information.Version.Major <= 9)
{
this.fullTextIndexingEnabled = false;
}
else
{
this.fullTextIndexingEnabled = true;
}
switch (context.SqlServerVersion)
{
case 6:
string errorMessage = manager.GetString("error_60compatibility");
throw new InvalidOperationException(errorMessage);
case 7:
this.databaseCompatibilityLevel = CompatibilityLevel.Version70;
break;
case 8:
this.databaseCompatibilityLevel = CompatibilityLevel.Version80;
break;
case 9:
this.databaseCompatibilityLevel = CompatibilityLevel.Version90;
break;
case 10:
this.databaseCompatibilityLevel = CompatibilityLevel.Version100;
break;
case 11:
this.databaseCompatibilityLevel = CompatibilityLevel.Version110;
break;
case 12:
this.databaseCompatibilityLevel = CompatibilityLevel.Version120;
break;
case 13:
this.databaseCompatibilityLevel = CompatibilityLevel.Version130;
break;
case 14:
this.databaseCompatibilityLevel = CompatibilityLevel.Version140;
break;
default:
this.databaseCompatibilityLevel = CompatibilityLevel.Version140;
break;
}
if (context.Server.ServerType == DatabaseEngineType.SqlAzureDatabase)
{ //These properties are only available for Azure DBs
this.azureEdition = AzureEdition.Standard;
this.azureEditionDisplayValue = azureEdition.ToString();
this.currentServiceLevelObjective = AzureSqlDbHelper.GetDefaultServiceObjective(this.azureEdition);
this.configuredServiceLevelObjective = AzureSqlDbHelper.GetDefaultServiceObjective(this.azureEdition);
this.maxSize = AzureSqlDbHelper.GetDatabaseDefaultSize(this.azureEdition);
}
}