小编Len*_*y D的帖子

CosmosDB 使用 CosmosClient 在 C# 中获取标量值

有谁知道如何使用 获取标量值Microsoft.Azure.Comos.CosmosClient

我浏览过网络,找不到任何示例。

我想做的就是能够执行这样的查询

SELECT value COUNT(c._id) 
FROM c 
WHERE c._ts > @timestamp
Run Code Online (Sandbox Code Playgroud)

CosmosClient或类上似乎没有任何函数Container来处理查询类型。

谢谢

c# azure-cosmosdb

4
推荐指数
1
解决办法
1771
查看次数

绑定到可观察数组

好的,有人可以请帮助我,我觉得我快疯了!!!

我在获取要在 angular2 中更新的列表时遇到问题,环顾四周,我似乎应该使用某种 Observables?

一切听起来都不错,但我在实施它们时遇到了很多问题。

我需要关于如何使用可观察数组并在 angular2 中绑定到它的帮助,以及使用可观察数组有什么好处?

例如,我有一个模型中的评论列表

  this.comments = new Array<IComment>;
  this.observableComments = Observable.from(this.comments);
  // Note what is really odd with the above is typescript thinks 
  // the above is Observable<IComment> ??? not Observable<IComment[]>
  // but when i debug it is ObservableArray with array property - ??
Run Code Online (Sandbox Code Playgroud)

我的模板中有以下 div

  this.comments = new Array<IComment>;
  this.observableComments = Observable.from(this.comments);
  // Note what is really odd with the above is typescript thinks 
  // the above is Observable<IComment> ??? not Observable<IComment[]>
  // …
Run Code Online (Sandbox Code Playgroud)

rxjs angular

3
推荐指数
1
解决办法
1万
查看次数

Ionic 4 + Angular 6 PWA 样式不起作用/损坏

希望有人能在这里帮助我,

我有一个使用 Angular 6 pwa 的 Ionic 4 应用程序。我已经按照这篇文章中的步骤让它工作

https://www.joshmorony.com/create-a-pwa-with-angular-service-workers-in-ionic-4/

所有步骤都完成得很好,而且包构建和运行正确,没有错误。

但是我所有的控件特定样式都丢失了,例如

我的controll.component.scss

  app-my-contol {

      ion-content {
        background-color: var(--light-gray-lightest);
      }
      .my-class {
        padding:0;
        list-style: none;
        position: absolute;
        width: 100%;
        left: 0;
    }
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明 您可以看到文件已正确散列,并且我没有 404 提示任何文件丢失。做一个正常的ionic cordova build没有--prod将使样式再次起作用。

任何帮助,将不胜感激!

编辑 - 快速更新。

所以缺少的样式似乎在 main_xxxxxxxxx.js 下面的示例片段中

var z = r.La({
            encapsulation: 0,
            styles: [["app-family-visit[_ngcontent-%COMP%]   .visit-details-family-view[_ngcontent-%COMP%]{margin-top:20px}@media (max-width:480px){app-family-visit[_ngcontent-%COMP%]   .visit-details-family-view[_ngcontent-%COMP%]{margin-top:10px}}app-family-visit[_ngcontent-%COMP%]   .visit-details-family-view[_ngcontent-%COMP%]   #title[_ngcontent-%COMP%]{margin-bottom:20px}app-family-visit[_ngcontent-%COMP%]   .datetime-md[_ngcontent-%COMP%]{padding-left:0}.verification_page[_ngcontent-%COMP%]{padding-top:15px}"]],
            data: {}
        });
Run Code Online (Sandbox Code Playgroud)

这个文件正在加载,但由于某种原因被忽略

另一个更新

有趣的是,在非 pwa 构建中,它在 main.js 中看起来像这样

/*!****************************************************************!*\
  !*** ./src/app/case/pages/family-visit/family-visit.page.scss ***!
  \****************************************************************/
/*! no …
Run Code Online (Sandbox Code Playgroud)

sass typescript ionic4 angular6

3
推荐指数
1
解决办法
5281
查看次数

如何在 Azure Active Directory 中获取用户的“分配角色”?

我将 Azure AD 与注册的应用程序一起使用,并使用 Microsoft Graph API 来查询 AD。

下面的代码告诉用户被分配到哪些组

var memberof = await graphClient.Users[xxx].MemberOf.Request().GetAsync();
Run Code Online (Sandbox Code Playgroud)

我正在使用标准 AD 套餐,似乎组受到一定限制,我需要购买“高级 AD 套餐”才能充分使用它们。

所以我不想使用群组信息。我对我分配给我的用户的角色感兴趣,这些角色已放入我的应用程序清单中。

例如

"appRoles": [
    {
      "allowedMemberTypes": [
        "User"
      ],
      "displayName": "Case Manager",
      "id": "{A_Guid}",
      "isEnabled": true,
      "description": "Case Manager's can create and assign Cases to other users",
      "value": "CaseManager"
    }, 
Run Code Online (Sandbox Code Playgroud)

那么,如何使用 Graph Api 来告诉我用户是否具有特定角色?

azure-active-directory microsoft-graph-api

3
推荐指数
1
解决办法
2万
查看次数

Azure Functions Kubernetes 找不到 local.settings.json

我正在尝试将 Azure Functions 应用程序发布到 Kubernetes,但运行此命令时出现以下错误

func kubernetes deploy --name my-function-api --namespace default --registry mycontainerregistry/docker-azure-function --csharp

无法找到项目根目录。期望在项目根目录中找到 host.json、local.settings.json 之一。`

这是我的 docker 文件

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS installer-env

COPY . .
RUN cd /MyFunctionApp.Api && \
    mkdir -p /home/site/wwwroot && \
    dotnet publish *.csproj --output /home/site/wwwroot

COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot

# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:2.0-appservice 
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"] …
Run Code Online (Sandbox Code Playgroud)

c# docker kubernetes azure-functions keda

2
推荐指数
1
解决办法
2261
查看次数

枚举树时不需要的分配

我在 C# 项目中使用 Jetbrains rider,并在调试时使用动态程序分析功能,并且我有一段代码在枚举树结构时显示高内存分配问题。

该树需要是线程安全的,因为它可以在枚举时被另一个线程写入。

这是似乎过度分配的违规代码,JetBrains 工具似乎认为问题是由于闭包对象引起的,但我不相信,它位于小对象堆上

public IEnumerator<TreeNode<T>> GetEnumerator()
{
    yield return this;

    if (this.children == null)
    {
        yield break;
    }

    // Copy the children in case the collection gets modified while reading
    var childrenCopy = new List<TreeNode<T>>(this.children);

    foreach (var child in childrenCopy)
    {
        foreach (var subChild in child)
        {
            yield return subChild;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

- 更新

我知道子副本将分配,但一旦超出范围,我希望它被释放而不是卡在小对象堆上

任何关于正在发生的事情的想法将不胜感激。

谢谢

.net c# .net-core

0
推荐指数
1
解决办法
57
查看次数