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
+41-8Lines changed: 41 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Examples
19
19
========
20
20
We'll use the following two classes for our examples
21
21
22
-
```csharp
22
+
```c#
23
23
publicclassDepartment
24
24
{
25
25
publicintId { get; set; }
@@ -43,7 +43,7 @@ We'll use the following two classes for our examples
43
43
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.
44
44
45
45
Example:
46
-
```csharp
46
+
```c#
47
47
varemp=newEmployee()
48
48
{
49
49
Company="Microsoft",
@@ -62,7 +62,7 @@ var emp = new Employee()
62
62
```
63
63
64
64
Below is an example that uses string keys instead:
65
-
```csharp
65
+
```c#
66
66
varemp=newEmployee()
67
67
{
68
68
Name="John Smith",
@@ -81,7 +81,7 @@ Below is an example that uses string keys instead:
81
81
When converting your POCO to a table entity and ultimately serializing and persisting to Azure Table Storage, you may want to ignore some fields. To ignore properties, use the optional ```ignoredProperties``` parameter.
In the above example the partition key is ```Company```, the row key is ```Id``` and we ignored ```ExternalId``` and ```HireDate```.
@@ -90,12 +90,12 @@ In the above example the partition key is ```Company```, the row key is ```Id```
90
90
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```).
91
91
92
92
Here is a simple example where we specify the partition key (```Company```) and the row key (```Id```):
In this example the partitionkey had a prefix of "company_" and the row key had a prefix of "employee_".
@@ -104,12 +104,12 @@ In this example the partitionkey had a prefix of "company_" and the row key had
104
104
When converting from a table entity, you may not want to populate any fields derived from `PartitionKey` and `RowKey`. One reason for doing this might be that those keys are complex (derived from multiple properties for instance), and you already have those simple properties in your entity.
105
105
106
106
For your conveninece you can use the simplified `FromTableEntity` method. This is the equivilant of doing
Copy file name to clipboardExpand all lines: src/TableStorage.Abstractions.TableEntityConverters/TableStorage.Abstractions.TableEntityConverters.csproj
0 commit comments