public ActionResult QueryByRowKey(string rowKey) { var sw = new Stopwatch(); sw.Start(); var account = GetAccountInfo(); var context = new TestContext(account.TableEndpoint.AbsoluteUri, account.Credentials); var query = context.CreateQuery<TestEntity>(TABLE_NAME); var entity = query.Where(e => e.RowKey== rowKey).ToList(); //var entity = (from e in context.CreateQuery<TestEntity>(TABLE_NAME) where e.RowKey==rowKey select e); ViewData["Data"] = entity; ViewData["Elapsed"] = sw.ElapsedMilliseconds; return View("Index"); }
public ActionResult QueryByRowkeyAndPartitionKey(string partitionKey, string rowKey) { var sw = new Stopwatch(); sw.Start(); var account = GetAccountInfo(); var context = new TestContext(account.TableEndpoint.AbsoluteUri, account.Credentials); var query = context.CreateQuery<TestEntity>(TABLE_NAME); var entity = query.Where(e => e.PartitionKey.Equals(partitionKey) && e.RowKey.Equals(rowKey)).ToList(); ViewData["Data"] = entity; ViewData["Elapsed"] = sw.ElapsedMilliseconds; return View("Index"); }
public ActionResult QueryByLastNameColumn(string lastName) { var sw = new Stopwatch(); sw.Start(); var account = GetAccountInfo(); var context = new TestContext(account.TableEndpoint.AbsoluteUri, account.Credentials); var query = context.CreateQuery<TestEntity>(TABLE_NAME); var entity = query.Where(e => e.LastName == lastName).ToList(); ViewData["Data"] = entity; ViewData["Elapsed"] = sw.ElapsedMilliseconds; return View("Index"); }