-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRelatedTableAttribute.cs
More file actions
58 lines (51 loc) · 2.52 KB
/
RelatedTableAttribute.cs
File metadata and controls
58 lines (51 loc) · 2.52 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
using System;
namespace CoreHelpers.WindowsAzure.Storage.Table.Attributes
{
public class RelatedTableAttribute : Attribute
{
/// <summary>
/// The partitionkey of the related table, if this is the name of a property on the model the property value will be used.
/// </summary>
public string PartitionKey { get; set; }
/// <summary>
/// The rowkey of the related table, if this is a property on the model, the property value will be loaded, if it is empty this will default to the name of the type.
/// </summary>
public string RowKey { get; set; }
/// <summary>
/// On saving the parent entity also save the related tables, currently not supported with null values in <see cref="RowKey"/>, Defaults to False.
/// </summary>
public bool AutoSave { get; set; }
//TODO:
//public bool AutoDelete { get; set; }
/// <summary>
///
/// </summary>
/// <param name="partitionKey">The partitionkey of the related table, if this is the name of a property on the model the property value will be used.</param>
public RelatedTableAttribute(string partitionKey)
{
PartitionKey = partitionKey;
}
/// <summary>
///
/// </summary>
/// <param name="partitionKey">The partitionkey of the related table, if this is the name of a property on the model the property value will be used.</param>
/// <param name="rowKey">The rowkey of the related table, if this is a property on the model, the property value will be loaded, if it is empty this will default to the name of the type.</param>
public RelatedTableAttribute(string partitionKey, string rowKey)
{
PartitionKey = partitionKey;
RowKey = rowKey;
}
/// <summary>
///
/// </summary>
/// <param name="partitionKey">The partitionkey of the related table, if this is the name of a property on the model the property value will be used.</param>
/// <param name="rowKey">The rowkey of the related table, if this is a property on the model, the property value will be loaded, if it is empty this will default to the name of the type.</param>
/// <param name="autoSave">Sets the autosave property</param>
public RelatedTableAttribute(string partitionKey, string rowKey, bool autoSave)
{
PartitionKey = partitionKey;
RowKey = rowKey;
AutoSave = autoSave;
}
}
}