public static Create ( dynamic entity, ReservedPropertyBehavior reservedPropertyBehavior = ReservedPropertyBehavior.Throw ) : |
||
entity | dynamic | |
reservedPropertyBehavior | ReservedPropertyBehavior | |
return |
/// <summary> /// Remove the instance from table storage /// </summary> /// <param name="tableName">Name of the table</param> /// <param name="instance">the instance to delete</param> /// <param name="conflictHandling">Method for handling ETag conflicts</param> public void Delete(string tableName, dynamic instance, ConflictHandling conflictHandling) { TableItem tableItem = TableItem.Create(instance, _reservedPropertyBehavior); if (tableItem.ETag == null) { Delete(tableName, tableItem.PartitionKey, tableItem.RowKey); } else { _context.DeleteItem(tableName, tableItem, conflictHandling); } }
/// <summary> /// Add instance to the given table /// </summary> /// <param name="tableName">name of the table</param> /// <param name="instance">instance to store</param> /// <remarks> /// This method assumes that T has string properties decorated by the /// PartitionKeyAttribute and RowKeyAttribute, which the framework uses to determine /// the partition and row keys for instance. /// </remarks> /// <exception cref="ArgumentException">if T does not have properties PartitionKey and or RowKey</exception> public void Add(string tableName, dynamic instance) { _context.AddNewItem(tableName, TableItem.Create(instance, _reservedPropertyBehavior)); }
/// <summary> /// Add entity to the given table /// </summary> /// <param name="tableName">Name of the table</param> /// <param name="instance">the instance to store</param> /// <param name="partitionKey">The partition key to use when storing the entity</param> /// <param name="rowKey">The row key to use when storing the entity</param> public void Add(string tableName, dynamic instance, string partitionKey, string rowKey) { _context.AddNewItem(tableName, TableItem.Create(instance, partitionKey, rowKey, _reservedPropertyBehavior)); }
/// <summary> /// Merge the entity /// </summary> /// <param name="tableName">Name of the table</param> /// <param name="instance">the instance to merge</param> /// <param name="conflictHandling">Method for handling ETag conflicts</param> public void Merge(string tableName, dynamic instance, ConflictHandling conflictHandling) { _context.Merge(tableName, TableItem.Create(instance, _reservedPropertyBehavior), conflictHandling); }
/// <summary> /// Update the entity with specified partition key and row key in table storage /// </summary> /// <param name="tableName">Name of the table</param> /// <param name="instance">the instance to update</param> /// <param name="partitionKey">The partition key to use when storing the entity</param> /// <param name="rowKey">The row key to use when storing the entity</param> /// <param name="conflictHandling">Method for handling ETag conflicts</param> public void Update(string tableName, dynamic instance, string partitionKey, string rowKey, ConflictHandling conflictHandling) { _context.Update(tableName, TableItem.Create(instance, partitionKey, rowKey, _reservedPropertyBehavior), conflictHandling); }