-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPropertyInfo.cs
56 lines (50 loc) · 1.33 KB
/
PropertyInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace Havit.Business;
/// <summary>
/// Bázová třída pro všechny property-info objektu.
/// </summary>
public abstract class PropertyInfo
{
private bool isInitialized = false;
/// <summary>
/// Třída, které property náleží.
/// </summary>
public ObjectInfo Owner
{
get { return owner; }
}
private ObjectInfo owner;
/// <summary>
/// Název property reprezentované instancí.
/// </summary>
public string PropertyName
{
get { return propertyName; }
}
private string propertyName;
/// <summary>
/// Inicializuje instanci.
/// </summary>
/// <param name="owner">ObjectInfo vlastnící property.</param>
/// <param name="propertyName">Název vlastnosti.</param>
[SuppressMessage("SonarLint", "S1117", Justification = "Není chybou mít parametr metody stejného jména ve třídě.")]
protected virtual void Initialize(ObjectInfo owner, string propertyName)
{
this.owner = owner;
this.propertyName = propertyName;
this.isInitialized = true;
}
/// <summary>
/// Ověří, že byla instance inicializována. Pokud ne, vyhodí výjimku.
/// </summary>
protected void CheckInitialization()
{
if (!isInitialized)
{
throw new InvalidOperationException("Instance nebyla inicializována.");
}
}
}