本文整理汇总了C#中Amazon.DynamoDBv2.DocumentModel.Table类的典型用法代码示例。如果您正苦于以下问题:C# Table类的具体用法?C# Table怎么用?C# Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于Amazon.DynamoDBv2.DocumentModel命名空间,在下文中一共展示了Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadTableAsync
internal static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null)
{
asyncOptions = asyncOptions??new AsyncOptions();
DynamoDBAsyncExecutor.ExecuteAsync<Table>(
()=>{
return LoadTable(ddbClient,tableName,consumer,conversion);
},asyncOptions,callback);
}
开发者ID:aws,项目名称:aws-sdk-net,代码行数:8,代码来源:Table.Async.cs
示例2: DynamoDBConfigurationFactory
public DynamoDBConfigurationFactory()
{
string accessKey = ConfigurationManager.AppSettings["DynamoDB.AccessKey"];
string secretKey = ConfigurationManager.AppSettings["DynamoDB.SecretKey"];
string tableName = ConfigurationManager.AppSettings["DynamoDB.TableName"];
AmazonDynamoDBClient dynmamoClient = new AmazonDynamoDBClient(accessKey, secretKey, RegionEndpoint.EUWest1);
_configTable = Table.LoadTable(dynmamoClient, tableName);
}
开发者ID:volkanx,项目名称:design-pattern-workout,代码行数:9,代码来源:DynamoDBConfigurationFactory.cs
示例3: DynamoDbDataWriter
/// <summary>
/// Initializes a new instance of the <see cref="DynamoDbDataWriter"/> class.
/// </summary>
/// <param name="endpoint">The AWS DynamoDb service endpoint.</param>
/// <param name="tableName">Name of the table used for logging.</param>
public DynamoDbDataWriter(string endpoint, string tableName="")
{
if (string.IsNullOrEmpty(endpoint))
{
endpoint = DefaultServiceEndpoint;
}
DynamoDbClient = new AmazonDynamoDBClient(new AmazonDynamoDBConfig {ServiceURL = endpoint});
LogTable = Table.LoadTable(DynamoDbClient, tableName);
}
开发者ID:taylan,项目名称:log4net.dynamodb2,代码行数:15,代码来源:DynamoDbDataWriter.cs
示例4: Table
private Table(AmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer)
{
DDBClient = ddbClient;
TableConsumer = consumer;
TableName = tableName;
Keys = new Dictionary<string, KeyDescription>();
HashKeys = new List<string>();
RangeKeys = new List<string>();
LocalSecondaryIndexes = new Dictionary<string, LocalSecondaryIndexDescription>();
LocalSecondaryIndexNames = new List<string>();
Attributes = new List<AttributeDefinition>();
}
开发者ID:skilitics,项目名称:aws-sdk-net,代码行数:12,代码来源:Table.cs
示例5: TryGetQueryFilterForTable
/// <summary>
/// Tries to make up a query request from the list of conditions using table keys and local secondary indexes
/// </summary>
internal static bool TryGetQueryFilterForTable(this TranslationResult translationResult, Table tableDefinition, out QueryFilter resultFilter, out string indexName)
{
resultFilter = null;
indexName = null;
Primitive hashKeyValue;
if (!translationResult.Conditions.TryGetValueForKey(tableDefinition.HashKeys[0], out hashKeyValue))
{
return false;
}
if (hashKeyValue == null)
{
throw new NotSupportedException("Hash key value should not be null");
}
resultFilter = new QueryFilter(tableDefinition.HashKeys[0], QueryOperator.Equal, hashKeyValue);
// Copying the list of conditions. without HashKey condition, which is already matched.
var conditions = translationResult.Conditions.ExcludeField(tableDefinition.HashKeys[0]);
if (conditions.Count <= 0)
{
return true;
}
// first trying to search by range key
if
(
(tableDefinition.RangeKeys.Count == 1)
&&
(TryMatchFieldWithCondition(tableDefinition.RangeKeys[0], resultFilter, conditions))
)
{
return TryPutRemainingConditionsToQueryFilter(resultFilter, conditions);
}
// now trying to use local secondary indexes
foreach (var index in tableDefinition.LocalSecondaryIndexes.Values)
{
// a local secondary index should always have range key
string indexedField = index.KeySchema.Single(kse => kse.KeyType == "RANGE").AttributeName;
if (TryMatchFieldWithCondition(indexedField, resultFilter, conditions))
{
indexName = index.IndexName;
return TryPutRemainingConditionsToQueryFilter(resultFilter, conditions);
}
}
return false;
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:54,代码来源:TranslationResultUtils.cs
示例6: LoadTableListener
void LoadTableListener ()
{
resultText.text = "\n***LoadTable***";
Table.LoadTableAsync(_client,"ProductCatalog",(loadTableResult)=>{
if(loadTableResult.Exception != null)
{
resultText.text += "\n failed to load product catalog table";
}
else
{
productCatalogTable = loadTableResult.Result;
LoadSampleProducts();
}
});
Table.LoadTableAsync(_client,"Thread",(loadTableResult)=>{
if(loadTableResult.Exception != null)
{
resultText.text += "\n failed to load thread table";
}
else
{
threadTable = loadTableResult.Result;
LoadSampleThreads();
}
});
Table.LoadTableAsync(_client,"Reply",(loadTableResult)=>{
if(loadTableResult.Exception != null)
{
resultText.text += "\n failed to load reply table";
}
else
{
replyTable = loadTableResult.Result;
LoadSampleReplies();
}
});
Table.LoadTableAsync(_client,"Forum",(loadTableResult)=>{
if(loadTableResult.Exception != null)
{
resultText.text += "\n failed to load reply table";
}
else
{
forumTable = loadTableResult.Result;
LoadSampleForums();
}
});
}
开发者ID:skleez,项目名称:Sasha_VM364,代码行数:48,代码来源:TableQueryAndScanExample.cs
示例7: TableDefinitionWrapperBase
internal TableDefinitionWrapperBase(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
{
this.TableDefinition = tableDefinition;
this.TableEntityType = tableEntityType;
this._consistentRead = consistentRead;
// if a predefined HashKey value was specified
if (hashKeyValue != null)
{
this._hashKeyType = hashKeyValue.GetType();
this.HashKeyValue = hashKeyValue.ToPrimitive(this._hashKeyType);
}
this.Cache = cacheImplementation;
this.Cache.Initialize(tableDefinition.TableName, this.TableEntityType, this.HashKeyValue);
}
开发者ID:vanderkorn,项目名称:linq2dynamodb,代码行数:16,代码来源:TableDefinitionWrapperBase.cs
示例8: CreateInstance
internal static IEntityKeyGetter CreateInstance(Table tableDefinition, Type entityType, Type hashKeyType, Primitive predefinedHashKeyValue)
{
if (predefinedHashKeyValue != null)
{
if (tableDefinition.RangeKeys.Count <= 0)
{
throw new InvalidOperationException("When specifying constant hash key values, the table must always have a range key");
}
var rangePropInfo = entityType.GetProperty(tableDefinition.RangeKeys[0], BindingFlags.Instance | BindingFlags.Public);
if (rangePropInfo == null)
{
throw new InvalidOperationException(string.Format("Entity type {0} doesn't contain range key property {1}", entityType.Name, tableDefinition.RangeKeys[0]));
}
return new ConstantHashRangeEntityKeyGetter(tableDefinition.HashKeys[0], hashKeyType, predefinedHashKeyValue, rangePropInfo);
}
if (tableDefinition.RangeKeys.Count > 0)
{
var hashPropInfo = entityType.GetProperty(tableDefinition.HashKeys[0], BindingFlags.Instance | BindingFlags.Public);
var rangePropInfo = entityType.GetProperty(tableDefinition.RangeKeys[0], BindingFlags.Instance | BindingFlags.Public);
if (hashPropInfo == null)
{
throw new InvalidOperationException(string.Format("Entity type {0} doesn't contain hash key property {1}", entityType.Name, tableDefinition.HashKeys[0]));
}
if (rangePropInfo == null)
{
throw new InvalidOperationException(string.Format("Entity type {0} doesn't contain range key property {1}", entityType.Name, tableDefinition.RangeKeys[0]));
}
return new HashRangeEntityKeyGetter(hashPropInfo, rangePropInfo);
}
else
{
var hashPropInfo = entityType.GetProperty(tableDefinition.HashKeys[0], BindingFlags.Instance | BindingFlags.Public);
if (hashPropInfo == null)
{
throw new InvalidOperationException(string.Format("Entity type {0} doesn't contain hash key property {1}", entityType.Name, tableDefinition.HashKeys[0]));
}
return new HashEntityKeyGetter(hashPropInfo);
}
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:45,代码来源:EntityKeyGetter.cs
示例9: TryGetEntityKeyForTable
/// <summary>
/// Tries to extract entity key from the list of conditions
/// </summary>
internal static EntityKey TryGetEntityKeyForTable(this TranslationResult translationResult, Table tableDefinition)
{
Primitive hashKeyValue;
if (!translationResult.Conditions.TryGetValueForKey(tableDefinition.HashKeys[0], out hashKeyValue))
{
return null;
}
if (hashKeyValue == null)
{
throw new InvalidOperationException("Hash key value should not be null");
}
// if there's a range key in the table
if (tableDefinition.RangeKeys.Any())
{
Primitive rangeKeyValue;
if(!translationResult.Conditions.TryGetValueForKey(tableDefinition.RangeKeys[0], out rangeKeyValue))
{
return null;
}
//TODO: check, that hash and range keys really cannot be null
if (rangeKeyValue == null)
{
throw new NotSupportedException("Range key value should not be null");
}
// if any other conditions except hash and range key specified
if (translationResult.Conditions.Count > 2)
{
throw new NotSupportedException("When requesting a single entity by it's hash key and range key, no need to specify additional conditions");
}
return new EntityKey(hashKeyValue, rangeKeyValue);
}
// if any other conditions except hash key specified
if (translationResult.Conditions.Count > 1)
{
throw new NotSupportedException("When requesting a single entity by it's hash key, no need to specify additional conditions");
}
return new EntityKey(hashKeyValue);
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:48,代码来源:TranslationResultUtils.cs
示例10: TableDefinitionWrapper
internal TableDefinitionWrapper(Table tableDefinition, Type tableEntityType, object hashKeyValue, ITableCache cacheImplementation, bool consistentRead)
: base(tableDefinition, tableEntityType, hashKeyValue, cacheImplementation, consistentRead)
{
if (this.HashKeyValue == null)
{
this.ToDocumentConversionFunctor = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
}
else
{
var converter = DynamoDbConversionUtils.ToDocumentConverter(this.TableEntityType);
// adding a step for filling in the predefined HashKey value
this.ToDocumentConversionFunctor = entity =>
{
var doc = converter(entity);
doc[this.TableDefinition.HashKeys[0]] = this.HashKeyValue;
return doc;
};
}
}
开发者ID:vanderkorn,项目名称:linq2dynamodb,代码行数:19,代码来源:TableDefinitionWrapper.cs
示例11: DynamoDBS3PublisherSettings
public DynamoDBS3PublisherSettings(Table configTable)
: base(configTable)
{
}
开发者ID:volkanx,项目名称:rareburg-article-feed-generator,代码行数:4,代码来源:DynamoDBS3PublisherSettings.cs
示例12: Copy
internal Table Copy(Table.DynamoDBConsumer newConsumer)
{
return new Table(this.DDBClient, this.TableName, newConsumer, this.Conversion)
{
KeyNames = this.KeyNames,
Keys = this.Keys,
RangeKeys = this.RangeKeys,
HashKeys = this.HashKeys,
Conversion = this.Conversion,
Attributes = this.Attributes,
GlobalSecondaryIndexes = this.GlobalSecondaryIndexes,
GlobalSecondaryIndexNames = this.GlobalSecondaryIndexNames,
LocalSecondaryIndexes = this.LocalSecondaryIndexes,
LocalSecondaryIndexNames = this.LocalSecondaryIndexNames,
ContainsCachedData = this.ContainsCachedData
};
}
开发者ID:johnryork,项目名称:aws-sdk-unity,代码行数:17,代码来源:Table.cs
示例13: SplitQueryFilter
private static void SplitQueryFilter(Filter filter, Table targetTable, string indexName, out Dictionary<string, Condition> keyConditions, out Dictionary<string, Condition> filterConditions)
{
QueryFilter queryFilter = filter as QueryFilter;
if (queryFilter == null) throw new InvalidOperationException("Filter is not of type QueryFilter");
keyConditions = new Dictionary<string, Condition>();
filterConditions = new Dictionary<string, Condition>();
var conditions = filter.ToConditions(targetTable.Conversion);
foreach (var kvp in conditions)
{
string attributeName = kvp.Key;
Condition condition = kvp.Value;
// depending on whether the attribute is key, place either in keyConditions or filterConditions
if (IsKeyAttribute(targetTable, indexName, attributeName))
keyConditions[attributeName] = condition;
else
filterConditions[attributeName] = condition;
}
}
开发者ID:yridesconix,项目名称:aws-sdk-net,代码行数:21,代码来源:Search.cs
示例14: ReadData
private async Task<string> ReadData(Table table, string id)
{
Document doc = await table.GetItemAsync(new Primitive(id));
var body = doc["Body"];
return body;
}
开发者ID:aws,项目名称:aws-sdk-net,代码行数:7,代码来源:DynamoDBTruncateError.cs
示例15: GetScanFilterForTable
/// <summary>
/// Prepares parameters for a scan operation from the list of conditions
/// </summary>
internal static ScanFilter GetScanFilterForTable(this TranslationResult translationResult, Table tableDefinition)
{
// the last thing to do is to make a full scan
var scanFilter = new ScanFilter();
//TODO: check for BETWEEN operator
foreach (var condition in translationResult.Conditions.Flatten())
{
if
(
(condition.Item2.Values.Length == 1)
&&
(condition.Item2.Values[0] == null)
)
{
switch (condition.Item2.Operator)
{
case ScanOperator.Equal:
scanFilter.AddCondition(condition.Item1, ScanOperator.IsNull );
break;
case ScanOperator.NotEqual:
scanFilter.AddCondition(condition.Item1, ScanOperator.IsNotNull);
break;
default:
throw new InvalidOperationException(string.Format("You cannot use {0} operator with null value", condition.Item2.Operator));
}
}
else
{
scanFilter.AddCondition(condition.Item1, condition.Item2.Operator, condition.Item2.Values);
}
}
return scanFilter;
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:38,代码来源:TranslationResultUtils.cs
示例16: DynamoDBApiSettings
public DynamoDBApiSettings(Table configTable)
: base(configTable)
{
}
开发者ID:volkanx,项目名称:design-pattern-workout,代码行数:4,代码来源:DynamoDBApiSettings.cs
示例17: Copy
internal Table Copy(Table.DynamoDBConsumer newConsumer)
{
return new Table(this.DDBClient, this.TableName, newConsumer, this.Conversion)
{
keyNames = this.keyNames,
Keys = this.Keys,
RangeKeys = this.RangeKeys,
HashKeys = this.HashKeys,
Conversion = this.Conversion
};
}
开发者ID:yridesconix,项目名称:aws-sdk-net,代码行数:11,代码来源:Table.cs
示例18: GetBatchGetOperationForSearchConditions
/// <summary>
/// Tries to make up a batch get operation from SearchConditions
/// </summary>
private static DocumentBatchGet GetBatchGetOperationForSearchConditions(Table tableDefinition, SearchConditions conditions, string keyFieldName, Primitive hashKeyValue)
{
// there should be only one IN operator for key field
if
(!(
(conditions.Count == 1)
&&
(conditions.Keys.First() == keyFieldName)
))
{
return null;
}
var conditionList = conditions.Values.First();
if
(!(
(conditionList.Count == 1)
&&
(conditionList.First().Operator == ScanOperator.In)
))
{
return null;
}
var result = tableDefinition.CreateBatchGet();
foreach (var value in conditionList.First().Values)
{
if (hashKeyValue == null)
{
result.AddKey((Primitive)value);
}
else
{
result.AddKey(hashKeyValue, (Primitive)value);
}
}
return result;
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:41,代码来源:TranslationResultUtils.cs
示例19: GetBatchGetOperationForTable
/// <summary>
/// Tries to make up a batch get operation for translation result
/// </summary>
internal static DocumentBatchGet GetBatchGetOperationForTable(this TranslationResult translationResult, Table tableDefinition)
{
var conditions = translationResult.Conditions;
// if there's a range key in the table
if (tableDefinition.RangeKeys.Any())
{
// HashKey should be exactly specified
Primitive hashKeyValue;
if (!conditions.TryGetValueForKey(tableDefinition.HashKeys[0], out hashKeyValue))
{
return null;
}
if (hashKeyValue == null)
{
throw new NotSupportedException("Hash key value should not be null");
}
return GetBatchGetOperationForSearchConditions(tableDefinition, conditions.ExcludeField(tableDefinition.HashKeys[0]), tableDefinition.RangeKeys.First(), hashKeyValue);
}
else
{
return GetBatchGetOperationForSearchConditions(tableDefinition, conditions, tableDefinition.HashKeys.First(), null);
}
}
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:28,代码来源:TranslationResultUtils.cs
示例20: Table
private Table(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion)
{
#if (WIN_RT || WINDOWS_PHONE)
DDBClient = ddbClient as AmazonDynamoDBClient;
#else
DDBClient = ddbClient;
#endif
TableConsumer = consumer;
TableName = tableName;
Keys = new Dictionary<string, KeyDescription>();
HashKeys = new List<string>();
RangeKeys = new List<string>();
LocalSecondaryIndexes = new Dictionary<string, LocalSecondaryIndexDescription>();
LocalSecondaryIndexNames = new List<string>();
GlobalSecondaryIndexes = new Dictionary<string, GlobalSecondaryIndexDescription>();
GlobalSecondaryIndexNames = new List<string>();
Attributes = new List<AttributeDefinition>();
Conversion = conversion;
}
开发者ID:yridesconix,项目名称:aws-sdk-net,代码行数:20,代码来源:Table.cs
注:本文中的Amazon.DynamoDBv2.DocumentModel.Table类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论