本文整理汇总了C#中Amazon.DynamoDB.DocumentModel.Document.GetAttributeNames方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetAttributeNames方法的具体用法?C# Document.GetAttributeNames怎么用?C# Document.GetAttributeNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Amazon.DynamoDB.DocumentModel.Document
的用法示例。
在下文中一共展示了Document.GetAttributeNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunDocumentModelSample
public static void RunDocumentModelSample()
{
Console.WriteLine("Loading Businesses table");
Table table = Table.LoadTable(client, "Businesses");
Console.WriteLine("Creating and saving first item");
Document chainStore2 = new Document();
chainStore2["Name"] = "Big Sales Inc";
chainStore2["Id"] = 2;
chainStore2["Owner"] = "Big Sales Corp";
chainStore2["Managers"] = new List<string> { "Samantha Jones", "Richard Frost" };
chainStore2["FoundedDate"] = new DateTime(1980, 7, 4);
chainStore2["Address"] = "123 Main Street, New York, New York";
chainStore2["Employees"] = 46;
chainStore2["State"] = "NY";
table.PutItem(chainStore2);
Console.WriteLine("Creating and saving first item");
Document chainStore13 = new Document();
chainStore13["Name"] = "Big Sales Inc";
chainStore13["Id"] = 13;
chainStore13["Owner"] = "Big Sales Corp";
chainStore13["Managers"] = new List<string> { "Anil Garg", "Alex Short" };
chainStore13["FoundedDate"] = new DateTime(1999, 3, 15);
chainStore13["Address"] = "1999 West Ave, Chicago, Illinois";
chainStore13["Employees"] = 54;
chainStore13["State"] = "IL";
table.PutItem(chainStore13);
Console.WriteLine("Creating and saving second item");
Document tinyDiner = new Document();
tinyDiner["Name"] = "Tiny Map-themed Diner";
tinyDiner["Id"] = 0;
tinyDiner["Owner"] = "John Doe";
tinyDiner["FoundedDate"] = new DateTime(1974, 12, 10);
tinyDiner["Address"] = "800 Lincoln Ave, Seattle, Washington";
tinyDiner["State"] = "WA";
table.PutItem(tinyDiner);
Console.WriteLine("Creating and saving third item");
Document internetStore = new Document();
internetStore["Name"] = "Best Online Store Ever";
internetStore["Id"] = 0;
internetStore["Owner"] = "Jane Doe";
internetStore["FoundedDate"] = new DateTime(1994, 2, 19);
internetStore["Employees"] = 5;
internetStore["Url"] = "http://www.best-online-store-ever.fake";
internetStore["Phone"] = "425-555-1234";
table.PutItem(internetStore);
Console.WriteLine("Loading item");
Document doc1 = table.GetItem("Big Sales Inc", 2);
Console.WriteLine("Attribute counts match (should be true): " +
(chainStore2.GetAttributeNames().Count == doc1.GetAttributeNames().Count));
Console.WriteLine("Loading item...");
Document doc2 = table.GetItem("Best Online Store Ever", 0);
Console.WriteLine("Attribute counts match (should be true): " +
(chainStore2.GetAttributeNames().Count == doc1.GetAttributeNames().Count));
Console.WriteLine("Change item: remove one attribute, add one, modify one attribute");
doc2["Phone"] = null;
doc2["Twitter"] = "best-online-store-ever";
doc2["Employees"] = 4;
Console.WriteLine("Updating item");
table.UpdateItem(doc2);
Console.WriteLine("Reloading item");
doc2 = table.GetItem("Best Online Store Ever", 0);
Console.WriteLine("Phone attribute present (should be false): " + doc2.Contains("Phone"));
Console.WriteLine("Twitter attribute present (should be true): " + doc2.Contains("Twitter"));
Console.WriteLine("Employees attribute equals 4: " + (doc2["Employees"].AsPrimitive().Value == "4"));
Console.WriteLine("Loading nonexistent item");
Document doc3 = table.GetItem("Big Sales Inc", 3);
Console.WriteLine("Returned document == null (should be true): " + (doc3 == null));
Search query;
Console.WriteLine();
Console.WriteLine("Querying for items (Equals)");
query = table.Query("Big Sales Inc", new RangeFilter(QueryOperator.Equal, 2));
List<Document> queryItems1 = query.GetRemaining();
Console.WriteLine("Number of items returned (should be 1): " + queryItems1.Count);
Console.WriteLine();
Console.WriteLine("Querying for items (Between)");
QueryOperationConfig queryConfig = new QueryOperationConfig
{
HashKey = "Big Sales Inc",
Filter = new RangeFilter(QueryOperator.Between, 0, 15),
Limit = 1
};
query = table.Query(queryConfig);
int totalItems = 0;
while (!query.IsDone)
{
Console.WriteLine("Retrieving next set (page) of items");
List<Document> querySet = query.GetNextSet();
Console.WriteLine("Number of items returned in set (should be 1, unless last set, which will be 0): " + querySet.Count);
foreach (Document doc in querySet)
//.........这里部分代码省略.........