Item
A base helper class that implements IItem
Namespace: Microsoft.Azure.CosmosRepository
Kind: class
A base helper class that implements IItem
public abstract class Item : IItemExample
Here is an example subclass item, which adds several properties:
public class SubItem : Item{ public DateTimeOffset Date { get; set; } public string Name { get; set; } public IEnumerable<Child> Children { get; set; } public IEnumerable<string> Tags { get; set; }}
public class Child{ public string Name { get; set; } public DateTime BirthDate { get; set; }}Members
Constructor
Item.Item()
Default constructor, assigns type name to Type property.
public Item()Propertys
Item.Id
Gets or sets the item’s globally unique identifier.
[JsonProperty("id")]public string Id { get; set; }Returns — String
Initialized by NewGuid.
Item.Type
Gets or sets the item’s type name. This is used as a discriminator.
[JsonProperty("type")]public string Type { get; set; }Returns — String
Method
Item.GetPartitionKeyValue()
Gets the partition key value for the given Item type.
When overridden, be sure that the Path value corresponds
to the PropertyName value, i.e.; “/partition” and “partition”
respectively. If these two values do not correspond an error will occur.
protected virtual string GetPartitionKeyValue()Returns — String: The Id unless overridden by the subclass.