-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathLocalization.cs
More file actions
69 lines (60 loc) · 1.92 KB
/
Localization.cs
File metadata and controls
69 lines (60 loc) · 1.92 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (C) 2003-2010 Xtensive LLC.
// All rights reserved.
// For conditions of distribution and use, see license.
// Created by: Dmitri Maximov
// Created: 2009.11.27
using System.Globalization;
namespace Xtensive.Orm.Localization
{
/// <summary>
/// Base localization class.
/// </summary>
[Serializable]
public abstract class Localization : Entity
{
/// <summary>
/// Gets or sets the name of the culture this particular localization is corresponds to.
/// </summary>
/// <value>The name of the culture.</value>
[Field(Length = 10), Key(0)]
public string CultureName { get; private set; }
// Constructor
/// <summary>
/// Initializes new instance of this type.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="culture">The culture.</param>
/// <param name="target">The target.</param>
protected Localization(Session session, CultureInfo culture, Entity target)
: base(session, culture.Name, target)
{
}
}
/// <summary>
/// Base localization class with typed reference to localizable one.
/// </summary>
/// <typeparam name="T"></typeparam>
[Serializable]
[KeyGenerator(KeyGeneratorKind.None)]
public abstract class Localization<T> : Localization where T : Entity
{
/// <summary>
/// Gets the target that is being localized.
/// </summary>
/// <value>The target.</value>
[Field, Key(1)]
[Association(PairTo = "Localizations", OnTargetRemove = OnRemoveAction.Cascade)]
public T Target { get; private set; }
// Constructor
/// <summary>
/// Initializes new instance of this type.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="culture">The culture.</param>
/// <param name="target">The target.</param>
protected Localization(Session session, CultureInfo culture, T target)
: base(session, culture, target)
{
}
}
}