Tag: Azure的表存储

我可以让我的类在运行时inheritance自另一个类吗?

我有一个类(人),它是我的MVVM应用程序中的模型。 我想将此类保存到Azure表存储。 要保存到Azure表存储,您需要从名为TableServiceEntity的类派生。 我宁愿不要将我的优秀课程与用于存储的属性混为一谈(考虑分离关注点似乎是一个好主意)。 我可以以某种方式让我的类在运行时派生自TableServiceEntity,在接收对象作为参数的方法中并将其持久存储到存储中吗? 这样可以让我的class级保持清洁存储属性,但仍然让我将它保存到表存储。 谢谢! 安迪

如何使用Linq查询Azure存储表?

我不知道到底在哪里,但我对此有错误的想法。 我试图在第一个实例中使用linq查询azure存储表。 但我无法弄清楚它是如何完成的。 从各种来源看我有以下几点: List blogs = new List(); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(“BlogConnectionString”)); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable blogTable = tableClient.GetTableReference(“BlogEntries”); try { TableServiceContext tableServiceContext = tableClient.GetTableServiceContext(); TableServiceQuery query = (from blog in blogTable.CreateQuery() select blog).AsTableServiceQuery(tableServiceContext); foreach (BlogEntry blog in query) { blogs.Add(new BlogViewModel { Body = blog.Body }); } } catch { } 在我搞砸之前,我可能已经把它靠近了。 […]

Azure Mobile Service TableController不返回内部对象

我正在使用表存储创建一个基本(我的第一个)Azure移动服务来控制一个简单的事件应用程序。 我的DataObjects由2个对象类型组成: Coordinator和Event ,我希望Coordinators是一个单独的表来存储特定信息,我不希望它在事件中被非规范化,但是事件还有一个内部对象Location来存储事件的详细信息位置,但我想存储非规范化,因为我不想将此细节与事件分开维护。 这是我到目前为止的对象:DataObjests: public class Coordinator : EntityData { public string Name { get; set; } public int Points { get; set; } public bool IsActive { get; set; } } public class Event: EntityData { public Coordinator Coordinator { get; set; } public DateTime EventDate { get; set; } public int Attendees […]

在Azure表中存储十进制数据类型

Windows Azure表存储不支持 十进制数据类型。 建议的解决方法是使用自定义属性将decimal属性序列化为字符串: [EntityDataType(PrimitiveTypeKind.String)] public decimal Quantity { get; set; } 如何实现此EntityDataType自定义属性,以便可以从Windows Azure表存储和检索十进制属性?

持久保存到Azure表存储时使用POCO

我打算在我的ASP.NET 5(MVC 6)应用程序中使用Azure表存储,并添加了WindowsAzure.Storage NuGet包,但当我注意到所有我需要的模型都需要从Microsoft.WindowsAzure.Storage.Table.TableEntityinheritance时,我感到非常失望.WindowsAzure Microsoft.WindowsAzure.Storage.Table.TableEntity 。 现在我认为最好的解决方案是拥有两组实体并在我的主域对象和用于持久存储到表存储的实体对象之间创建映射。 我不想将WindowsAzure.Storage包添加到我的所有项目中。 弃用的azure-sdk-for-net在某一点上得到了对POCO的支持,但我在目前的WindowsAzure.Storage中没有看到这一点。 这里的最佳做法是什么?

如何使用Azure Table Storage的单个查询检索多种类型的实体?

我正在尝试了解Azure表存储如何工作以创建Facebook样式的源,我仍然坚持如何检索条目。 (我的问题几乎与https://stackoverflow.com/questions/6843689/retrieve-multiple-type-of-entities-from-azure-table-storage相同,但答案中的链接已被破坏。) 这是我的预期方法: 为我的应用程序中的所有用户创建个人订阅源,其中包含不同类型的条目(通知,状态更新等)。 我的想法是将它们存储在按每个用户的分区键分组的Azure表中。 检索同一分区键中的所有条目,并根据条目类型将其传递给不同的视图。 如何在保留其唯一属性的同时查询所有类型的相同基类型的表存储? CloudTableQuery需要一个类型化实体,如果我将EntryBase指定为generics参数,则不会获得特定于条目的属性( NotificationSpecificProperty , StatusUpdateSpecificProperty ),反之亦然。 我的实体: public class EntryBase : TableServiceEntity { public EntryBase() { } public EntryBase(string partitionKey, string rowKey) { this.PartitionKey = partitionKey; this.RowKey = rowKey; } } public class NotificationEntry : EntryBase { public string NotificationSpecificProperty { get; set; } } public class StatusUpdateEntry : […]

如何在Azure中执行区分大小写的LINQ查询?

我正在使用Windows Azure存储表,并希望查询对象。 用户输入一个字符串,我在数据库中查找如下: var myKey = “SomeCaseSensitiveKeyInputByTheUser”; var someObject = (from o in dataContext.Objects where o.SomeString.Equals(myKey) select o).FirstOrDefault(); 但是,由于某种原因,所有字符串比较似乎都不区分大小写( ==和string.Equals() )。 但是,我需要匹配用户输入字符串的确切大小写。 我怎样才能在LINQ查询中执行此操作?

在Azure表存储中更新RowKey或PartitionKey

我可以在Azure表存储中更新实体的RowKey或PartitionKey属性吗? 我想是或者可能只是PartitionKey但现在我正在尝试这样做(尝试更改RowKey或PartitionKey)并得到错误: The remote server returned an error: (404) Not Found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found. Source […]

如何从azure表存储查询中获取超过1000个实体?

我已经读过azure表存储查询最多可以提供1000个实体,我们必须使用continuation令牌来获取下一组实体。 我只是想找一个简单的方法来做到这一点。 我想要做的就是获取查询应该实际返回的所有实体,而不仅仅是1000个实体。 我在这里阅读了@smarxpost,他提到了TableStorageDataServiceQuery ExecuteAll方法,但由于我无法在存储客户端库中找到TableStorageDataServiceQuery ,因此这似乎已被弃用。 我还发现了这个msdn文档,介绍了如何处理连续令牌以获取所有实体。 我只是想知道这是否是获得所有实体的最佳方式,我不需要任何分页。 或者我可以使用任何ExecuteAll esque方法吗?

如何使用Azure TableClient 2.0 BeginExecuteQuerySegmented

我试图异步获取表中的所有条目,但我无法弄清楚如何使用延续令牌 。 我怀疑我需要采用我的匿名方法并将其转换为委托,然后使用延续令牌递归调用它。 如何获取以下代码并执行异步调用并获取新API中的所有条目? Task GetAllTableEntries(CloudTable tbl, string[] urls, string name, CancellationToken token) { TableRequestOptions reqOptions = new TableRequestOptions() { }; OperationContext ctx = new OperationContext() { ClientRequestID = “” }; object state = null; // Register Cancelation Token ICancellableAsyncResult result = null; TableQuery qry = new TableQuery(); TableContinuationToken tok = null; result = tbl.BeginExecuteQuerySegmented(qry, […]