You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75Lines changed: 75 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,84 @@ The Azure Storage SDK requires that objects that it works with to implement the
8
8
9
9
This simple library seeks to take care of the mapping for us, so that you can continue to write your domain objects as POCOs, while still being able to leverage the Azure Storage SDK.
10
10
11
+
The library will convert simple properties to fields in Azure Table Storage. Complex types will serialize as json.
12
+
11
13
Examples
12
14
========
13
15
We'll use the following two classes for our examples
14
16
17
+
```csharp
18
+
publicclassDepartment
19
+
{
20
+
publicintId { get; set; }
21
+
publicstringName { get; set; }
22
+
publicGuid? OptionalId { get; set; }
23
+
24
+
}
25
+
publicclassEmployee
26
+
{
27
+
publicEmployee()
28
+
{
29
+
30
+
}
31
+
publicstringCompany { get; set; }
32
+
publicintId { get; set; }
33
+
publicGuidExternalId { get; set; }
34
+
publicstringName { get; set; }
35
+
publicDateTimeOffsetHireDate { get; set; }
36
+
publicDateTimeOffset? TermDate { get; set; }
37
+
publicDepartmentDepartment { get; set; }
38
+
}
39
+
```
40
+
41
+
## Convert to Table Entity
42
+
Converting to a table entity is easy. Use the ``.ToTableEntity()`` extension method and specify which properties represent the partition key and row key. If you need to customize how any of those two keys serialize there are overloads that accept string values.
HireDate=DateTimeOffset.Parse("Thursday, January 31, 2008")
76
+
};
77
+
vartableEntity=emp.ToTableEntity("Google", "42");
78
+
```
79
+
## Convert from Table Entity
80
+
Converting from a table entity is just as simple. If the both the partition keys can be converted to simple types, you can use the shorter overloaded extension method (```FromTableEntity```).
15
81
82
+
Here is a simple example where we specify the partition key (```Company```) and the row key (```Id```):
0 commit comments