本文整理汇总了C#中Amazon.DynamoDB.DocumentModel.Primitive类的典型用法代码示例。如果您正苦于以下问题:C# Primitive类的具体用法?C# Primitive怎么用?C# Primitive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Primitive类属于Amazon.DynamoDB.DocumentModel命名空间,在下文中一共展示了Primitive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Primitive
/// <summary>
/// Attribute accessor, allows getting or setting of an individual attribute.
/// </summary>
/// <param name="key">Name of the attribute.</param>
/// <returns>Current value of the attribute.</returns>
public DynamoDBEntry this[string key]
{
get
{
return currentValues[key];
}
set
{
if (value == null)
{
currentValues[key] = new Primitive();
}
else
{
currentValues[key] = value;
}
}
}
示例2: BeginUpdateItem
/// <summary>
/// Initiates the asynchronous execution of the UpdateItem operation.
/// <seealso cref="Amazon.DynamoDB.DocumentModel.Table.UpdateItem"/>
/// </summary>
/// <param name="doc">Attributes to update.</param>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateItem
/// operation.</returns>
public IAsyncResult BeginUpdateItem(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, AsyncCallback callback, object state)
{
return DynamoDBAsyncExecutor.BeginOperation(() => UpdateHelper(doc, MakeKey(hashKey, rangeKey), config, true), callback, state);
}
示例3: BeginGetItem
/// <summary>
/// Initiates the asynchronous execution of the GetItem operation.
/// <seealso cref="Amazon.DynamoDB.DocumentModel.Table.GetItem"/>
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetItem
/// operation.</returns>
public IAsyncResult BeginGetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, AsyncCallback callback, object state)
{
return DynamoDBAsyncExecutor.BeginOperation(() => GetItemHelper(MakeKey(hashKey, rangeKey), config, true), callback, state);
}
示例4: AddKey
/// <summary>
/// Add a single item to get, identified by its hash-and-range primary key.
/// </summary>
/// <param name="hashKey">Hash key element of the item to get.</param>
/// <param name="rangeKey">Range key element of the item to get.</param>
public void AddKey(Primitive hashKey, Primitive rangeKey)
{
Keys.Add(TargetTable.MakeKey(hashKey, rangeKey));
}
示例5: UpdateItem
/// <summary>
/// Update a document in DynamoDB, with a hash-and-range primary key to identify
/// the document, and using the specified config.
/// </summary>
/// <param name="doc">Attributes to update.</param>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <returns>Null or updated attributes, depending on config.</returns>
/// <seealso cref="Amazon.DynamoDB.DocumentModel.UpdateItemOperationConfig"/>
public Document UpdateItem(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config)
{
return UpdateHelper(doc, MakeKey(hashKey, rangeKey), config, false);
}
示例6: Query
/// <summary>
/// Initiates a Search object to Query a DynamoDB table, with the
/// specified hash primary key and filter.
///
/// No calls are made until the Search object is used.
/// </summary>
/// <param name="hashKey">Hash key element parameter of the query.</param>
/// <param name="filter">Filter to use.</param>
/// <returns>Resultant Search container.</returns>
public Search Query(Primitive hashKey, RangeFilter filter)
{
return Query(new QueryOperationConfig { HashKey = hashKey, Filter = filter });
}
示例7: GetItem
/// <summary>
/// Gets a document from DynamoDB by hash-and-range primary key.
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
/// <returns>Document from DynamoDB.</returns>
public Document GetItem(Primitive hashKey, Primitive rangeKey)
{
return GetItemHelper(MakeKey(hashKey, rangeKey), null, false);
}
示例8: UpdateItem
/// <summary>
/// Update a document in DynamoDB, with a hash primary key to identify the
/// document, and using the specified config.
/// </summary>
/// <param name="doc">Attributes to update.</param>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <returns>Null or updated attributes, depending on config.</returns>
/// <seealso cref="Amazon.DynamoDB.DocumentModel.UpdateItemOperationConfig"/>
public Document UpdateItem(Document doc, Primitive hashKey, UpdateItemOperationConfig config)
{
return UpdateHelper(doc, MakeKey(hashKey, null), config);
}
示例9: GetItem
/// <summary>
/// Gets a document from DynamoDB by hash primary key, using specified configs.
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <returns>Document from DynamoDB.</returns>
public Document GetItem(Primitive hashKey, GetItemOperationConfig config)
{
return GetHelper(MakeKey(hashKey, null), config);
}
示例10: DeleteItem
/// <summary>
/// Delete a document in DynamoDB, identified by a hash primary key,
/// using specified configs.
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="config">Configuration to use.</param>
/// <returns>Null or old attributes, depending on config.</returns>
public Document DeleteItem(Primitive hashKey, DeleteItemOperationConfig config)
{
return DeleteHelper(MakeKey(hashKey, null), config);
}
示例11: DeleteItem
/// <summary>
/// Delete a document in DynamoDB, identified by a hash-and-range primary key.
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
public void DeleteItem(Primitive hashKey, Primitive rangeKey)
{
DeleteHelper(MakeKey(hashKey, rangeKey), null, false);
}
示例12: AttributeValueToDynamoDBEntry
internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue attributeValue)
{
Primitive primitive = null;
if (attributeValue.S != null)
{
primitive = new Primitive(attributeValue.S);
}
else if (attributeValue.N != null)
{
primitive = new Primitive(attributeValue.N, true);
}
else if (attributeValue.B != null)
{
primitive = new Primitive(attributeValue.B);
}
if (primitive != null)
return primitive;
PrimitiveList primitiveList = null;
if (attributeValue.SS != null && attributeValue.SS.Count != 0)
{
primitiveList = new PrimitiveList(DynamoDBEntryType.String);
foreach (string item in attributeValue.SS)
{
primitive = new Primitive(item);
primitiveList.Add(primitive);
}
}
else if (attributeValue.NS != null && attributeValue.NS.Count != 0)
{
primitiveList = new PrimitiveList(DynamoDBEntryType.Numeric);
foreach (string item in attributeValue.NS)
{
primitive = new Primitive(item, true);
primitiveList.Add(primitive);
}
}
else if (attributeValue.BS != null && attributeValue.BS.Count != 0)
{
primitiveList = new PrimitiveList(DynamoDBEntryType.Binary);
foreach (MemoryStream item in attributeValue.BS)
{
primitive = new Primitive(item);
primitiveList.Add(primitive);
}
}
if (primitiveList != null)
return primitiveList;
return null;
}
示例13: BeginDeleteItem
/// <summary>
/// Initiates the asynchronous execution of the DeleteItem operation.
/// <seealso cref="Amazon.DynamoDB.DocumentModel.Table.DeleteItem"/>
/// </summary>
/// <param name="hashKey">Hash key element of the document.</param>
/// <param name="rangeKey">Range key element of the document.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteItem
/// operation.</returns>
public IAsyncResult BeginDeleteItem(Primitive hashKey, Primitive rangeKey, AsyncCallback callback, object state)
{
return DynamoDBAsyncExecutor.BeginOperation(() => { DeleteHelper(MakeKey(hashKey, rangeKey), null, true); return null; }, callback, state);
}
示例14: MakeKey
internal Key MakeKey(Primitive hashKey, Primitive rangeKey)
{
Key newKey = new Key();
newKey.HashKeyElement = hashKey.ConvertToAttributeValue();
if (HashKeyType != hashKey.Type)
throw new InvalidOperationException("Table schema hash key inconsistent with specified hash key value");
if ((rangeKey == null) == RangeKeyIsDefined)
{
throw new ArgumentException("Range Key does not match schema");
}
else
{
if (RangeKeyIsDefined)
{
newKey.RangeKeyElement = rangeKey.ConvertToAttributeValue();
if (RangeKeyType != rangeKey.Type)
throw new InvalidOperationException("Table schema range key inconsistent with specified range key value");
}
}
return newKey;
}
示例15: Add
/// <summary>
/// Adds a Primitive to the end of the list.
/// </summary>
/// <param name="value">Primitive to add.</param>
public void Add(Primitive value)
{
this.Entries.Add(value);
}