这个问题是关于JSON批处理的两个问题
我尝试批处理的请求是这些请求的组合:
似乎有些租户(这是一个多租户应用程序)的限制为 4,我们的租户限制为 15,这似乎是平均值。
如果我检查提到的 20,我会收到 HTTP 400 错误请求异常。但是具有 15 到 20 个“子请求”组合的批处理请求会产生 HTTP 200 Ok 响应,其中一些 json 描述子请求的状态。那里显示429状态。
{
"id": "04",
"status": 204,
"headers": {
"Cache-Control": "private"
},
"body": null
}
Run Code Online (Sandbox Code Playgroud)
对比
{
"id": "12",
"status": 429,
"headers": {
"Retry-After": "1",
"Cache-Control": "private"
},
"body": {
"error": {
"code": "ApplicationThrottled", …Run Code Online (Sandbox Code Playgroud) 实体框架有一些关于嵌入实体的很好的文档,但我不知道如何嵌入一个简单的字符串数组IEnumerable<string>。
样板课
public class Post {
public string Id {get;set;}
public string Content {get;set;}
public IEnumerable<string> Tags {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
这应该在 cosmos 中保存为:
{
"id": "xxx",
"content": "long content here",
"tags": ["tag1", "tag2"],
...
}
Run Code Online (Sandbox Code Playgroud)
我知道我必须在OnModelCreating(ModelBuilder modelBuilder)上下文中配置一些东西。但我无法正确设置它。
我尝试过以下选项(以及其他几种ToJsonProperty方法):
modelBuilder.Entity<Post>().OwnsMany(p => p.Tags);modelBuilder.Entity<Post>().OwnsMany<string>(p => p.Tags);最终我希望能够根据这些标签进行查询,非常感谢任何帮助或正确方向的指示!
我也找到了这个答案,但是将数组转换为逗号分隔的字符串会达不到目的(因为这不允许我们查询这些帖子)。
其他人在 Microsoft 论坛上问了大致相同的问题,其中一位 Microsoft 员工表示,在纯 CosmosDB 中,可以在 cosmos 中嵌入字符串数组。
c# entity-framework-core azure-cosmosdb azure-cosmosdb-sqlapi
在尝试创建用于批量更新用户日历的deamon应用程序时,我偶然发现了以下文档:
由于您似乎可以在"不要将此API用于新项目API"中批量(也称合并)最多20个请求,但您最多只能使用新的Microsoft Graph API组合5个请求.
我发现没有批处理创建和删除100个日历项目大约需要40秒.由于应用程序管理变得如此简单,我想使用新的API,但是有没有任何更改,5请求批量限制将被删除,让我们说20就像旧的API一样?
我想读取一个包含一些可选列的 CSV 文件,因为我已经使用“?”定义了一个具有可选属性的类。但无法使其发挥作用。
public class MyItem
{
public int Id { get; set; }
public int? MyValue { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
映射类:
public sealed class MyItemMap : ClassMap<MyItem>
{
public MyItemMap()
{
Map(m => m.Id);
Map(m => m.MyValue);
}
}
Run Code Online (Sandbox Code Playgroud)
然后是控制台应用程序:
static void Main(string[] args)
{
using (var reader = new StreamReader(@"C:\Test2Delete\ConsoleAppCSV\MyItem.csv"))
using (var csv = new CsvReader(reader))
{
csv.Configuration.RegisterClassMap(new MyItemMap());
csv.Configuration.HeaderValidated = null;
try
{
var records = csv.GetRecords<MyItem>();
foreach (var r in records)
{
Console.WriteLine(r.Id + " …Run Code Online (Sandbox Code Playgroud) 我想知道我是否做错了什么,我希望MassTransit会自动ReceiveEndpoints在EndpointConvention.
示例代码:
services.AddMassTransit(x =>
{
x.AddServiceBusMessageScheduler();
x.AddConsumersFromNamespaceContaining<MyNamespace.MyRequestConsumer>();
x.UsingAzureServiceBus((context, cfg) =>
{
// Load the connection string from the configuration.
cfg.Host(context.GetRequiredService<IConfiguration>().GetValue<string>("ServiceBus:ConnectionString"));
cfg.UseServiceBusMessageScheduler();
// Without this line I'm getting an error complaining about no endpoint convention for x could be found.
EndpointConvention.Map<MyRequest>(new Uri("queue:queue-name"));
cfg.ReceiveEndpoint("queue-name", e =>
{
e.MaxConcurrentCalls = 1;
e.ConfigureConsumer<MyRequestConsumer>(context);
});
cfg.ConfigureEndpoints(context);
});
});
Run Code Online (Sandbox Code Playgroud)
我认为EndpointConvention.Map<MyRequest>(new Uri("queue:queue-name"));在不指定队列名称的情况下允许发送到总线不需要这条线,或者我错过了什么?
await bus.Send<MyRequest>(new { ...});