Skip to content

Commit eb381bf

Browse files
committed
Improved session and domain configuration elements
- added validators for some fields - used default value from constant instead of literal - fixed type of collection
1 parent cdf41d2 commit eb381bf

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Orm/Xtensive.Orm/Orm/Configuration/Elements/DomainConfigurationElement.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public ConfigurationCollection<DatabaseConfigurationElement> Databases
245245
/// <see cref="DomainConfiguration.KeyGenerators" copy="true"/>
246246
/// </summary>
247247
[ConfigurationProperty(KeyGeneratorsElementName, IsDefaultCollection = false)]
248-
[ConfigurationCollection(typeof (ConfigurationCollection<DatabaseConfigurationElement>), AddItemName = "keyGenerator")]
248+
[ConfigurationCollection(typeof (ConfigurationCollection<KeyGeneratorConfigurationElement>), AddItemName = "keyGenerator")]
249249
public ConfigurationCollection<KeyGeneratorConfigurationElement> KeyGenerators
250250
{
251251
get { return (ConfigurationCollection<KeyGeneratorConfigurationElement>) this[KeyGeneratorsElementName]; }
@@ -295,7 +295,8 @@ public bool IncludeSqlInExceptions
295295
/// <summary>
296296
/// <see cref="DomainConfiguration.AllowCyclicDatabaseDependencies" copy="true"/>
297297
/// </summary>
298-
[ConfigurationProperty(AllowCyclicDatabaseDependenciesElementName, DefaultValue = false)]
298+
[ConfigurationProperty(AllowCyclicDatabaseDependenciesElementName,
299+
DefaultValue = DomainConfiguration.DefaultAllowCyclicDatabaseDependencies)]
299300
public bool AllowCyclicDatabaseDependencies
300301
{
301302
get { return (bool) this[AllowCyclicDatabaseDependenciesElementName]; }

Orm/Xtensive.Orm/Orm/Configuration/Elements/SessionConfigurationElement.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public string Password {
6868
/// </summary>
6969
[ConfigurationProperty(CacheSizeElementName,
7070
DefaultValue = SessionConfiguration.DefaultCacheSize)]
71+
[IntegerValidator(MinValue = 1, MaxValue = int.MaxValue)]
7172
public int CacheSize {
7273
get { return (int) this[CacheSizeElementName]; }
7374
set { this[CacheSizeElementName] = value; }
@@ -114,6 +115,7 @@ public int? DefaultCommandTimeout {
114115
/// </summary>
115116
[ConfigurationProperty(BatchSizeElementName,
116117
DefaultValue = SessionConfiguration.DefaultBatchSize)]
118+
[IntegerValidator(MinValue = 1, MaxValue = int.MaxValue)]
117119
public int BatchSize {
118120
get { return (int) this[BatchSizeElementName]; }
119121
set { this[BatchSizeElementName] = value; }
@@ -142,6 +144,7 @@ public string ServiceContainerType {
142144
/// </summary>
143145
[ConfigurationProperty(EntityChangeRegistrySizeElementName,
144146
DefaultValue = SessionConfiguration.DefaultEntityChangeRegistrySize)]
147+
[IntegerValidator(MinValue = 1, MaxValue = int.MaxValue)]
145148
public int EntityChangeRegistrySize {
146149
get { return (int) this[EntityChangeRegistrySizeElementName]; }
147150
set { this[EntityChangeRegistrySizeElementName] = value; }

0 commit comments

Comments
 (0)