1010/// </remarks>
1111public class EnvironmentConfiguration
1212{
13- private long ? _mapSize ;
14- private int ? _maxReaders ;
15- private int ? _maxDatabases ;
16-
1713 /// <summary>
1814 /// Gets or sets the size of the memory map (in bytes) for a LightningEnvironment.
1915 /// </summary>
@@ -27,11 +23,7 @@ public class EnvironmentConfiguration
2723 /// Use caution when setting this value in applications running in 32-bit processes, as the effective addressable memory
2824 /// space is limited. For such scenarios, auto-adjustments may be applied to ensure compatibility.
2925 /// </remarks>
30- public long MapSize
31- {
32- get => _mapSize ?? 0 ;
33- set => _mapSize = value ;
34- }
26+ public long MapSize { get ; set ; }
3527
3628 /// <summary>
3729 /// Gets or sets the maximum number of reader slots available for a LightningEnvironment instance.
@@ -44,11 +36,7 @@ public long MapSize
4436 /// property after the environment is already initialized will result in an exception. Adjust this parameter to match
4537 /// the requirements of your application's workload and concurrency needs.
4638 /// </remarks>
47- public int MaxReaders
48- {
49- get => _maxReaders ?? 0 ;
50- set => _maxReaders = value ;
51- }
39+ public int MaxReaders { get ; set ; }
5240
5341 /// <summary>
5442 /// Gets or sets the maximum number of databases that can be opened within a LightningEnvironment instance.
@@ -63,11 +51,7 @@ public int MaxReaders
6351 /// Configuring the appropriate <c>MaxDatabases</c> value is particularly relevant for applications requiring concurrency or
6452 /// multiple named databases.
6553 /// </remarks>
66- public int MaxDatabases
67- {
68- get => _maxDatabases ?? 0 ;
69- set => _maxDatabases = value ;
70- }
54+ public int MaxDatabases { get ; set ; }
7155
7256 /// <summary>
7357 /// Gets or sets a value indicating whether the map size should be automatically reduced
@@ -86,13 +70,13 @@ public int MaxDatabases
8670
8771 internal void Configure ( LightningEnvironment env )
8872 {
89- if ( _mapSize . HasValue )
90- env . MapSize = _mapSize . Value ;
73+ if ( MapSize > 0 )
74+ env . MapSize = MapSize ;
9175
92- if ( _maxDatabases . HasValue )
93- env . MaxDatabases = _maxDatabases . Value ;
76+ if ( MaxDatabases > 0 )
77+ env . MaxDatabases = MaxDatabases ;
9478
95- if ( _maxReaders . HasValue )
96- env . MaxReaders = _maxReaders . Value ;
79+ if ( MaxReaders > 0 )
80+ env . MaxReaders = MaxReaders ;
9781 }
9882}
0 commit comments