每个人都警告不要在Azure表存储(ATS)中查询RowKey或PartitionKey以外的任何内容,以免被迫进行表扫描.有一段时间,当我需要查询其他内容时,这让我陷入困境,试图找到正确的PK和RK并在其他表中创建伪二级索引.
但是,在我认为合适时,我会在SQL Server中进行常见的表扫描.
所以问题就变成了,我可以多快地扫描Azure表.这是实体/秒中的常量还是取决于记录大小等.如果您需要响应式应用程序,是否有一些关于有多少记录对于表扫描来说太多的经验法则?
我有一个实体,其中包含TimeSpan我想要保存在Azure表存储中的属性.当我尝试保存实体时,我收到错误:
无法转换为不支持的类型'TimeSpan'
有没有办法进行自动转换或其他方式支持TimeSpan?
背景
我从客户端接收CSV数据文件,其中包含我不需要的大量数据以及我所做的少量数据.在将来,我可能需要访问该数据,虽然我正在归档原始数据文件,但我希望能够更容易地查询.我希望一个解决方案并不意味着数据文件保持相同的格式 - 即客户端可能添加/删除列,我不希望我的实现保留丢失的数据或无法存档其他数据.
当我在Azure中构建应用程序时,Azure表存储对我来说是正确的 - 我可以读取数据文件,然后将我读取的任何键/值对存储到数据存储中.
结果
我想知道如何存储Dictionary<K, V>或Hashtable或在Azure中的一些其他键/值对.
我正在查询表中的实体,更改它们,然后执行替换操作.替换操作失败,因为etag上的etag属性为null.我检查过,当我从CreateQuery()调用中获取实体时etag为null,但是当我执行Retrieve()时填充etag.有没有办法手动获取etag?
IEnumerable<MyEntity> query = from e in serviceContext.CreateQuery<MyEntity>(tableName)
where e.Id == queryId
select e;
MyEntity entity = query.FirstOrDefault();
// Update the MyEntity object
var replaceOperation = TableOperation.Replace(entity);
MyCloudTableClient.GetTableReference(tableName).Execute(replaceOperation);
// Exception is thrown here that eTag value is null
Run Code Online (Sandbox Code Playgroud) 我正在尝试针对每笔交易更新用户信用/计数信息.如果我们每秒达到超过2/4的交易,则下面的更新不会更新计数/用户信用信息.
两个问题基本上.
我正在使用Azure为SMS API进行从RDMBS迁移到NoSQL的原型.不知道为什么会发生这样的事情.
代码粘贴如下
public function update_credit_to_azure_table () {
// Create table REST proxy.
$tableRestProxy = ServicesBuilder::getInstance()
->createTableService($this->connectionString);
$result = $tableRestProxy->getEntity("tblapilogin", $this->apiusr , $this->apiusr);
$entity = $result->getEntity();
$new_api_balance = $this->global_api_credit - $this->credittodeduct;
$credit_used = $this->api_credit_used + $this->credittodeduct;
$entity->setPropertyValue("global_api_credit", $new_api_balance); //Update Balance.
$entity->setPropertyValue("api_credit_used", $credit_used); //credit used Updated .
try {
$tableRestProxy->updateEntity("tblapilogin", $entity);
echo "<br>New Blance is: " . $new_api_balance;
echo "<br>credit_used is: " . $credit_used;
}
catch(ServiceException $e) {
$code = $e->getCode();
$error_message = $e->getMessage();
echo …Run Code Online (Sandbox Code Playgroud) 我正在关注本教程Table Storage Service.我正在使用本教程的模拟器版本,您可以在"使用云服务时配置连接字符串"一节的第5点找到该版本.
这是我在"关于"中粘贴的代码ActionResult:
public ActionResult About()
{
// Retrieve the storage account from the connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the CloudTable object that represents the "people" table.
CloudTable table = tableClient.GetTableReference("people");
// Create a new customer entity.
CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
customer1.Email = "Walter@contoso.com";
customer1.PhoneNumber = "425-555-0101";
// Create the TableOperation that inserts the customer entity.
TableOperation insertOperation …Run Code Online (Sandbox Code Playgroud) 这个博客:
关于ASP.NET身份提供者状态:
持久控制
默认情况下,ASP.NET Identity系统会将所有用户信息存储在数据库中.ASP.NET Identity使用Entity Framework Code First来实现其所有持久性机制.
如果您的应用程序要求是此信息可能存储在不同的存储机制中,例如SharePoint,Azure表服务,无Sql数据库等,则现在可以插入不同的存储提供程序.
但是如何使用Azure表服务呢?我的研究表明你不能将实体框架与表服务一起使用,所以我认为你必须完全替换使用实体框架的代码,但我不确定.
相关问题:我是EF的新手.我们如何定制数据的存储方式(即使在SQL服务器中)?我发现了两个显示向用户表添加额外字段的示例:
http://www.asp.net/web-api/overview/security/external-authentication-services
但我不清楚究竟发生了什么.我认为它首先使用实体框架代码,但我看到很少有关于如何自定义EF为此存储数据的文档.例如,我可以重命名实体吗?我可以定义数据库的名称吗?
谢谢...
-ben
entity-framework azure azure-table-storage owin asp.net-identity
什么是table.Execute命令在Azure表存储中插入数据时的OperationContext的基本目的?
我碰巧看到table.Execute命令有一个名为OperationContext的参数...是什么目的...而且我看到OperationContext类有2个事件
`opContext.SendingRequest += opContext_SendingRequest;
opContext.ResponseReceived+=opContext_ResponseReceived;`
Run Code Online (Sandbox Code Playgroud)
它的目的是什么...它在桌子上有什么帮助.执行命令.?...如果有任何例子深刻的恭维......
要使用Azure存储(模拟器)表服务,我需要为我的TypeScript浏览器应用程序添加CORS规则.
我想使用REST接口手动添加该规则(来自Postman,而不是具有相同原始策略的浏览器).该文档未提供模拟器的正确URL(https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties).对于DML命令,它就像我的请求(https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-entity).
请求是:
PUT /devstoreaccount1/?restype=service&comp=properties HTTP/1.1
Host: 127.0.0.1:10002
x-ms-version: 2013-08-15
Content-Type: application/xml
Cache-Control: no-cache
Postman-Token: 280f880b-d6df-bb1d-bc12-eca411e18310
<StorageServiceProperties>
<Cors>
<CorsRule>
<AllowedOrigins>http://localhost:3030</AllowedOrigins>
<AllowedMethods>GET,PUT,POST</AllowedMethods>
<MaxAgeInSeconds>500</MaxAgeInSeconds>
<ExposedHeaders>x-ms-meta-data*,x-ms-meta-target*,x-ms-meta-abc</ExposedHeaders>
<AllowedHeaders>x-ms-meta-*</AllowedHeaders>
</CorsRule>
</Cors>
</StorageServiceProperties>
Run Code Online (Sandbox Code Playgroud)
结果是:
<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>ResourceNotFound</m:code>
<m:message xml:lang="en-US">The specified resource does not exist.
RequestId:8137042f-0402-46c6-aa8c-fbf9f4601d33
Time:2017-01-15T09:13:51.7500394Z</m:message>
</m:error>
Run Code Online (Sandbox Code Playgroud)
什么是正确的URL或我做错了什么?
azure azure-storage cors azure-table-storage azure-storage-emulator
我在Azure上运行了多个Windows VM,这些Windows VM配置为收集性能计数器和事件日志。
所有这些都在Azure Portal内VM资源的“诊断设置...”中进行配置。有一个Windows Azure Diagnostics代理,可在VM上收集此数据并将其存储到存储帐户(表存储内部)中。
所有收集的数据(性能计数器,指标,日志等)都没有任何保留策略,而且似乎没有任何设置方法。因此,它只会永久存储在存储帐户的表存储中。
这就是我的问题所在-这些表中现在有太多数据(在我的情况下为几个TB),仅保留它就花费了很多钱。而且它只会随着时间的推移而不断增加。
相关的存储帐户表如下所示:
WADMetrics* (Windows Azure诊断指标表)WADPerformanceCountersTable (Windows Azure诊断性能计数器表)WASWindowsEventLogsTable (Windows Azure诊断Windows事件日志表)有什么方法可以删除这些表中的旧数据,从而不会破坏任何数据吗?甚至更好的是,是否有某种方法可以配置或设置保留策略,以使其不会永远累积下去?
azure azure-storage azure-table-storage azure-diagnostics retention