Skip to content

Commit 86692cb

Browse files
committed
PropertyValidator: No meaningless Domain chech on init
1 parent 639f2d3 commit 86692cb

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

Orm/Xtensive.Orm/Orm/Validation/PropertyValidator.cs

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2013-2021 Xtensive LLC.
1+
// Copyright (C) 2013-2022 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
@@ -15,51 +15,20 @@ namespace Xtensive.Orm.Validation
1515
/// </summary>
1616
public abstract class PropertyValidator : Attribute, IPropertyValidator
1717
{
18-
private bool isImmediate;
19-
private bool validateOnlyIfModified;
20-
private bool skipOnTransactionCommiting;
21-
2218
/// <summary>
2319
/// Gets or sets value indicating if current validator is immediate.
2420
/// </summary>
25-
public bool IsImmediate
26-
{
27-
get => isImmediate;
28-
init {
29-
if (Domain != null) {
30-
throw Exceptions.AlreadyInitialized(null);
31-
}
32-
isImmediate = value;
33-
}
34-
}
21+
public bool IsImmediate { get; init; }
3522

3623
/// <summary>
3724
/// Gets or sets value indicating wheteher validation should continue only if field value has changed.
3825
/// </summary>
39-
public bool ValidateOnlyIfModified
40-
{
41-
get => validateOnlyIfModified;
42-
init {
43-
if (Domain != null) {
44-
throw Exceptions.AlreadyInitialized(null);
45-
}
46-
validateOnlyIfModified = value;
47-
}
48-
}
26+
public bool ValidateOnlyIfModified { get; init; }
4927

5028
/// <summary>
5129
/// Gets or sets value indicating if current validator should be skipped on a transaction commit.
5230
/// </summary>
53-
public bool SkipOnTransactionCommit
54-
{
55-
get => skipOnTransactionCommiting;
56-
init {
57-
if (Domain != null) {
58-
throw Exceptions.AlreadyInitialized(null);
59-
}
60-
skipOnTransactionCommiting = value;
61-
}
62-
}
31+
public bool SkipOnTransactionCommit { get; init; }
6332

6433
/// <summary>
6534
/// Gets domain this instance is bound to.

0 commit comments

Comments
 (0)