Skip to content

Commit 19cecfa

Browse files
committed
Add DefaultLanguage class and update SqlDatabase to handle DefaultLanguage properties
1 parent 7310231 commit 19cecfa

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

source/Classes/020.SqlDatabase.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,6 @@ class SqlDatabase : SqlResourceBase
827827
# Integer properties (require type cast)
828828
$integerProperties = @(
829829
'ChangeTrackingRetentionPeriod'
830-
'DefaultFullTextLanguage'
831-
'DefaultLanguage'
832830
'MaxDop'
833831
'MaxDopForSecondary'
834832
'MirroringRedoQueueMaxSize'
@@ -842,6 +840,17 @@ class SqlDatabase : SqlResourceBase
842840
$currentState.$propertyName = [System.Int32] $databaseObject.$propertyName
843841
}
844842

843+
# DefaultLanguage properties (SMO returns DefaultLanguage object with Lcid property)
844+
if ($null -ne $databaseObject.DefaultFullTextLanguage)
845+
{
846+
$currentState.DefaultFullTextLanguage = [System.Int32] $databaseObject.DefaultFullTextLanguage.Lcid
847+
}
848+
849+
if ($null -ne $databaseObject.DefaultLanguage)
850+
{
851+
$currentState.DefaultLanguage = [System.Int32] $databaseObject.DefaultLanguage.Lcid
852+
}
853+
845854
# Double properties
846855
$currentState.MaxSizeInBytes = [System.Double] $databaseObject.MaxSizeInBytes
847856

tests/Unit/Stubs/SMO.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,26 @@ public ServerRole( Object server, string name ) {
793793
}
794794

795795

796+
// TypeName: Microsoft.SqlServer.Management.Smo.DefaultLanguage
797+
// Used by:
798+
// Database.DefaultLanguage
799+
// Database.DefaultFullTextLanguage
800+
public class DefaultLanguage
801+
{
802+
public DefaultLanguage()
803+
{
804+
}
805+
806+
public DefaultLanguage(int lcid, string name)
807+
{
808+
this.Lcid = lcid;
809+
this.Name = name;
810+
}
811+
812+
public int Lcid { get; set; }
813+
public string Name { get; set; }
814+
}
815+
796816
// TypeName: Microsoft.SqlServer.Management.Smo.Database
797817
// BaseType: Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase
798818
// Used by:
@@ -903,8 +923,6 @@ public class Database
903923
// Integer Properties
904924
public int ActiveConnections = 5;
905925
public int ChangeTrackingRetentionPeriod = 2;
906-
public int DefaultFullTextLanguage = 1033;
907-
public int DefaultLanguage = 0;
908926
public int ID = 5;
909927
public int MaxDop = 0;
910928
public int MaxDopForSecondary = 0;
@@ -913,6 +931,10 @@ public class Database
913931
public int MirroringSafetySequence = 1;
914932
public int MirroringTimeout = 10;
915933
public int TargetRecoveryTime = 60;
934+
935+
// Language Properties
936+
public DefaultLanguage DefaultFullTextLanguage = new DefaultLanguage(1033, "English");
937+
public DefaultLanguage DefaultLanguage = new DefaultLanguage(0, "");
916938
public int TwoDigitYearCutoff = 2049;
917939
public int Version = 904;
918940

0 commit comments

Comments
 (0)